Overview
This section contains detailed API documentation for all public types, traits, and functions in the Shadow Agent SDK.Core Components
Agent
The main agent struct and its methods
Tools
Tool trait and built-in implementations
MCP
Model Context Protocol client and server
Types
Common types and structures
Agent API
Agent::new
Create a new agent instance.api_key: Your LLM provider API key
Result<Agent>: The initialized agent or an error
Agent::with_config
Create an agent with custom configuration.api_key: Your LLM provider API keyconfig: Agent configuration options
Agent::execute
Execute a task and get the response.prompt: The task description or question
Result<String>: The agent’s response
Agent::execute_stream
Execute a task and stream the response.prompt: The task description
Result<Stream>: A stream of response chunks
Agent::add_tool
Register a tool with the agent.tool: The tool instance to register
Agent::add_mcp_client
Add an MCP client to the agent.client: The MCP client instance
AgentConfig
Configuration options for agent behavior.model: LLM model identifiermax_tokens: Maximum response lengthtemperature: Randomness (0.0 - 1.0)system_prompt: Optional system instructions
Tool Trait
Implement this trait to create custom tools.name(): Return the tool’s identifierdescription(): Describe what the tool doesparameters(): JSON schema for parametersexecute(): Implement tool logic
Error Types
All errors implementstd::error::Error.