Skip to main content
Core TypeScript types for the @mariozechner/pi-agent-core package.

Import

Agent Types

AgentState

Complete agent state.

AgentMessage

Union of LLM messages and custom messages.
Apps can extend with custom message types via declaration merging:

AgentTool

Tool definition.

AgentToolResult

Tool execution result.
Content[]
Content blocks sent to LLM
T
Metadata for UI/logging (not sent to LLM)

ThinkingLevel

Reasoning intensity.

Context Types

AgentContext

Context passed to agent loop.

AgentLoopConfig

Configuration for agent loop.

Event Types

AgentEvent

Union of all agent events.

AgentStartEvent

AgentEndEvent

MessageStartEvent

MessageUpdateEvent

MessageEndEvent

ToolExecutionStartEvent

ToolExecutionUpdateEvent

ToolExecutionEndEvent

TurnStartEvent

TurnEndEvent

Callback Types

AgentToolUpdateCallback

Callback for streaming tool execution progress.
Use this to stream tool output:

Stream Function Type

StreamFn

Custom stream function type.
Used for custom transports (see Transport).

Example: Type-Safe Agent