Skip to main content

Module agent

Module agent 

Source
Expand description

§Core components of AI Agents

This module contains core components that you can use in your AI Agents

To read more about Agents look into crate::agent::Agent

To read more about structured output look into crate::structured_output

To read more about tool look into crate::tool

Structs§

Agent
The Agent struct represents an agent that interacts with a chat model.
AgentRequest
A prepared run of an Agent, created by Agent::run or Agent::run_stream.
AgentResult
The result of a successful run.
AgentStream
Stream of AgentEvents of one run, returned by awaiting Agent::run_stream.
ChatOptions
Model options sent with every request: temperature, max tokens, tool choice, reasoning effort, …
Complete
Mode of an AgentRequest created by Agent::run: awaiting it returns a AgentResult.
LlmError
Error of the LLM client: a failed request, or a client that could not be built.
RunOptions
Settings that replace the Agent configuration for one run.
Streaming
Mode of an AgentRequest created by Agent::run_stream: awaiting it returns an AgentStream.
Usage
Tokens used by a run. See AgentResult::usage.

Enums§

AgentError
Errors returned by Agent.
AgentEvent
Something that happened during a streamed run, see Agent::run_stream.
Provider
LLM provider for Agent::new_with_provider.
ReasoningEffort
How much a model should reason. See ChatOptions::reasoning_effort.
StopReason
Why the model stopped writing. See AgentResult::stop_reason.
ToolChoice
Whether and which tools the model must call. See ChatOptions::tool_choice.

Constants§

DEFAULT_MAX_ITERATIONS
Default number of model calls in one run.