Module text

Module text 

Source
Expand description

Text-based agent execution — request/response LLM pipelines.

While Agent::run_live() operates over a Gemini Live WebSocket session, TextAgent::run() makes standard BaseLlm::generate() calls. This enables dispatching text-based agent pipelines from Live session event hooks.

§Agent types

TypePurpose
LlmTextAgentCore agent — generate → tool dispatch → loop
FnTextAgentZero-cost state transform (no LLM call)
SequentialTextAgentRun children in order, state flows forward
ParallelTextAgentRun children concurrently via tokio::spawn
LoopTextAgentRepeat until max iterations or predicate
FallbackTextAgentTry each child, first success wins
RouteTextAgentState-driven deterministic branching
RaceTextAgentRun concurrently, first to finish wins
TimeoutTextAgentWrap an agent with a time limit
MapOverTextAgentIterate an agent over a list in state
TapTextAgentRead-only observation (no mutation)
DispatchTextAgentFire-and-forget background tasks
JoinTextAgentWait for dispatched tasks

Structs§

DispatchTextAgent
Fire-and-forget background task launcher with global task budget.
FallbackTextAgent
Tries each child agent in sequence. Returns the first successful result. If all fail, returns the last error.
FnTextAgent
Zero-cost state transform agent — executes a closure, no LLM call.
JoinTextAgent
Waits for dispatched background tasks and collects their results.
LlmTextAgent
Core text agent — calls BaseLlm::generate(), dispatches tools, loops until the model produces a final text response.
LoopTextAgent
Runs a text agent repeatedly until max iterations or a state predicate.
MapOverTextAgent
Iterates a single agent over each item in a state list. Reads state[list_key], runs agent per item (setting state[item_key]), collects results into state[output_key].
ParallelTextAgent
Runs text agents concurrently. All branches share state. Results are collected and joined with newlines.
RaceTextAgent
Runs agents concurrently, returns the first to complete. Cancels the rest.
RouteRule
A routing rule: predicate over state → target agent.
RouteTextAgent
State-driven deterministic branching — evaluates predicates in order, dispatches to the first matching agent. Falls back to default if none match.
SequentialTextAgent
Runs text agents sequentially. Each agent sees state mutations from previous agents. The final agent’s output is the pipeline’s output.
TapTextAgent
Read-only observation agent. Calls a function with the state but cannot mutate it. Returns empty string. No LLM call.
TaskRegistry
Shared registry for dispatched background tasks.
TimeoutTextAgent
Wraps an agent with a time limit. Returns AgentError::Timeout if exceeded.

Traits§

TextAgent
A text-based agent that runs via BaseLlm::generate() (request/response).