Construct a new Agent instance with provided LangModel and Tools.
Note that the ownership of tools is moved to the agent, which means you can't directly accessible to tools after the agent is initialized.
If you still want to reuse the tools, try to use addTool() multiple times instead.
Note that the ownership of tools is moved to the agent, which means you can't directly accessible to tools after this function is called.
If you still want to reuse the tools, try to use addTool() multiple times instead.
Optionalconfig: AgentConfig | nullOptionalconfig: AgentConfig | null
The Agent is the central orchestrator that connects the language model, tools, and knowledge components. It manages the entire reasoning and action loop, coordinating how each subsystem contributes to the final response.
In essence, the Agent:
Public APIs
run_delta: Runs a user query and streams incremental deltas (partial outputs)run: Runs a user query and returns a complete message once all deltas are accumulatedDelta vs. Complete Message
A delta represents a partial piece of model output, such as a text fragment or intermediate reasoning step. Deltas can be accumulated into a full message using the provided accumulation utilities. This allows real-time streaming while preserving the ability to reconstruct the final structured result.
See
MessageDelta.Components
Agentdetects tool calls and automatically executes them during the reasoning loop.Agentenriches model input with these results before generating an answer.