v0.1.6·Technical Reference
API Reference
Complete API reference for agents and MCPs
API Reference
Complete reference for the Agents and MCPs API.
Core Types
Message
Represents a message in conversation:
Agent
Configuration for an AI agent:
Tool
Definition of a tool available to agents:
ToolCall
Represents tool invocation:
Agent API
useAgent Hook
Use an agent in your React component:
Parameters:
config: AgentConfig- Agent configuration
Returns:
agent: Agent- The agent instancemessages: Message[]- Conversation historyisLoading: boolean- Currently processingsend: (content: string) => Promise<void>- Send messagereset: () => void- Clear conversationstatus: 'idle' | 'thinking' | 'calling-tool'- Agent status
send()
Send a message to the agent:
reset()
Clear conversation history:
MCP Server API
MCPServer
Create an MCP server:
server.registerTool()
Add a tool dynamically:
server.deregisterTool()
Remove a tool:
MCP Client API
MCPClient
Connect to an MCP server:
client.getTools()
Get available tools:
client.callTool()
Invoke a tool:
client.callToolStream()
Stream tool response:
Error Handling
MCPError
Standard error type:
Common Error Codes:
TOOL_NOT_FOUND(404)INVALID_PARAMETERS(400)AUTHENTICATION_FAILED(401)AUTHORIZATION_FAILED(403)TOOL_TIMEOUT(504)INTERNAL_ERROR(500)
Error Handling Example
Memory Management
MemoryConfig
Configure agent memory:
Memory Types
- none: No memory
- short-term: Keep recent messages (default)
- long-term: Persistent across sessions
- hybrid: Combine short and long-term
Events
Agent Events
Streaming
Streaming Responses
Rate Limiting
Rate Limit Headers
Pagination
List Operations
Versioning
API versions in URL:
Changelog
v1.0.0
- Initial release
- Basic agent functionality
- MCP server support
- Tool integration
Support
For API issues or questions, refer to Examples & Use Cases or check MCPs Overview.
© 2025 UI Lab • Built for humans and machines