Expand description
The agent turn loop.
Implements the standard function-calling loop: call the provider; while it
asks for tools, execute them and feed the results back; repeat until the
model ends its turn. Provider streaming chunks are folded into a turn via
polyc_llm::turn::collect_turn; the assistant/tool messages are
mapped to wire Messages for the control plane.
Re-exports§
pub use handoff::DEFAULT_MAX_CARRY;pub use handoff::HANDOFF_TOOL_NAME;pub use handoff::HandoffRequest;pub use handoff::handoff_tool_spec;pub use handoff::parse_handoff_args;pub use llm_summarizer::LlmSummarizer;
Modules§
- handoff
- Handoff (sub-agent transfer) primitive for the agent turn loop.
- llm_
summarizer - LLM-backed anchored-iterative
Summarizer. - participation
- The provider-agnostic “should the agent speak?” classifier.
Structs§
- Pending
Approval - One tool call awaiting human-in-the-loop approval.
- RunTurn
Options - Options for a single
run_turninvocation. - Stub
Summarizer - Deterministic placeholder summarizer — formats a tiny excerpt of the transcript so the data path is exercisable without a provider. Real deployments swap in an LLM-backed summarizer (one-trait swap).
- Stub
Tools - Placeholder executor: advertises no tools and reports any call it receives as unhandled (the model shouldn’t call anything without specs, but the guard keeps the loop progressing if it does).
- Turn
Result - Output of one
run_turncall.
Enums§
- Turn
Stream Event - Re-export so callers can build a streaming channel without depending on
polyc-llmdirectly. An incremental event observed while folding a turn, for live streaming.
Constants§
- SUMMARY_
TRIGGER - Trigger threshold for summarization.
Traits§
- Summarizer
- Produces a textual summary of a transcript chunk that’s about to be
dropped from the prompt window. Implementations can be deterministic
(the
StubSummarizer) or LLM-backed (a follow-up). - Tool
Executor - Executes a tool call by name, returning a JSON result string. Also advertises the tools it can execute so the provider knows what’s callable.
Functions§
- current_
tool_ call_ id - Returns the provider-assigned id of the tool call currently executing, when
called from within a
run_turn_withtool execution;Noneoutside that scope. - llm_
stop_ to_ wire_ i32 - Map an
llm-sideStopReasonto the wire enum value. - llm_
to_ wire - Convert an llm
LlmMessageback to a wireMessagefor transmission overHarnessService. - run_
turn - Run one agent turn to completion with no caller-supplied options (the
common path; equivalent to
run_turn_with(..., RunTurnOptions::default())). - run_
turn_ with - Run one agent turn to completion with caller-supplied
RunTurnOptions. - text_
message - Build a wire
Messagecarrying a single text content block. - tool_
call_ message - Build a wire
Messagecarrying a structured tool call. - tool_
result_ message - Build a wire
Messagecarrying a structured tool result keyed to its originatingcall_id. - wire_
to_ llm - Convert an owned wire
Messageinto an llmLlmMessage. - wire_
to_ llm_ stop - Inverse of
llm_stop_to_wire_i32: lift a wire enum value back. - with_
tool_ call_ id - Runs
futwithcurrent_tool_call_idset toidfor its duration.