Agentagent/api-reference
Agent API Reference
This describes the public API from indusagi/agent.
Types are defined in indusagi/src/agent/types.ts and behavior in indusagi/src/agent/agent.ts.
Agent Class
Constructor options (AgentOptions):
initialState?: Partial<AgentState>convertToLlm?: (messages: AgentMessage[]) => Message[] | Promise<Message[]>transformContext?: (messages: AgentMessage[], signal?) => Promise<AgentMessage[]>steeringMode?: "all" | "one-at-a-time"followUpMode?: "all" | "one-at-a-time"streamFn?: StreamFnsessionId?: stringgetApiKey?: (provider: string) => Promise<string | undefined> | string | undefinedthinkingBudgets?: ThinkingBudgets
Key methods:
prompt(input)accepts string,AgentMessage, orAgentMessage[].continue()resumes after user or tool messages in context.abort()cancels an in-flight request.steer(message)injects a message after the current tool execution.followUp(message)runs when the agent would otherwise stop.subscribe(listener)receivesAgentEventupdates.
State accessors:
stateprovides the currentAgentState.sessionIdgetter and setter.thinkingBudgetsgetter and setter.
AgentState
Fields:
systemPromptmodelthinkingLeveltoolsmessagesisStreamingstreamMessagependingToolCallserror
AgentEvent
Events emitted by the loop:
agent_start,agent_endturn_start,turn_endmessage_start,message_update,message_endtool_execution_start,tool_execution_update,tool_execution_end
Tool Types
AgentTool extends Tool with:
label: stringexecute(toolCallId, params, signal, onUpdate)
AgentToolResult contains:
content: (TextContent | ImageContent)[]details: TDetails
On This Page
