Skip to content

API Reference

The main class for creating and running agents.

new Agent(config: AgentConfig)
PropertyTypeRequiredDescription
providerProviderYesLLM provider instance
toolsTool[]NoAvailable tools
systemPromptstringNoSystem prompt for the agent
maxStepsnumberNoMaximum reasoning steps (default: 10)
memoryMemoryNoMemory implementation

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.

Helper to create type-safe tools.

defineTool(config: ToolConfig): Tool
PropertyTypeRequiredDescription
namestringYesUnique tool identifier
descriptionstringYesWhat the tool does (shown to LLM)
parametersobjectYesJSON Schema for parameters
executefunctionYesImplementation function
new OllamaProvider({
model: string,
baseUrl?: string, // default: http://localhost:11434
})
new LiteLLMProvider({
model: string,
baseUrl: string,
apiKey?: string,
})