API Reference
The main class for creating and running agents.
new Agent(config: AgentConfig)AgentConfig
Section titled “AgentConfig”| Property | Type | Required | Description |
|---|---|---|---|
provider | Provider | Yes | LLM provider instance |
tools | Tool[] | No | Available tools |
systemPrompt | string | No | System prompt for the agent |
maxSteps | number | No | Maximum reasoning steps (default: 10) |
memory | Memory | No | Memory implementation |
Methods
Section titled “Methods”agent.run(goal: string): Promise<AgentResult>
Section titled “agent.run(goal: string): Promise<AgentResult>”Execute the agent with a goal. Returns the final result after the reasoning loop completes.
agent.stream(goal: string): AsyncGenerator<AgentStep>
Section titled “agent.stream(goal: string): AsyncGenerator<AgentStep>”Stream individual reasoning steps as they happen.
defineTool
Section titled “defineTool”Helper to create type-safe tools.
defineTool(config: ToolConfig): ToolToolConfig
Section titled “ToolConfig”| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique tool identifier |
description | string | Yes | What the tool does (shown to LLM) |
parameters | object | Yes | JSON Schema for parameters |
execute | function | Yes | Implementation function |
Providers
Section titled “Providers”OllamaProvider
Section titled “OllamaProvider”new OllamaProvider({ model: string, baseUrl?: string, // default: http://localhost:11434})LiteLLMProvider
Section titled “LiteLLMProvider”new LiteLLMProvider({ model: string, baseUrl: string, apiKey?: string,})