Skip to main content

Function tools

Wrap any async function as a LangChain BaseTool:
Or use LangChain’s @tool decorator directly - both work with LlmAgent.

AgentTool - sub-agents as tools

Wrap a BaseAgent so it can be called as a tool by a parent agent:
The tool derives a child context with branch isolation and a clean session automatically. Sub-agent events stream through the parent in real-time via ctx.event_callback - each event carries a branch field (e.g. "ResearchAgent") for attribution.

AgentTool callbacks

Hook into the child agent’s event stream with before_agent_callback (intercept each event, optionally short-circuit) and after_agent_callback (run after completion):
Any custom tool can push events the same way:

Transfer tool - explicit agent handoff

Exit loop tool

Signal a LoopAgent to stop iterating:

CallContext

Inside a tool’s _arun(), use CallContext to read/write agent state:
LlmAgent automatically calls inject_context() on any tool that exposes it before each tool execution.

Filesystem tools

Sandboxed file operations restricted to a configurable workspace directory. All paths are validated to prevent escaping the workspace.
In Composer YAML, use the filesystem builtin:

Shell tools

Sandboxed shell execution with timeout, output truncation, and command filtering.
Configuration via environment variables: In Composer YAML, use the shell builtin: