pig/agent/effect

Effect types for the sans-IO agent core.

Effects are declarations of intent — the core describes what it wants done, and a runtime interprets these effects against the real world.

Two effects cover the entire agent loop: CallProvider — send messages to the LLM ExecuteTools — run tool calls

The on_response / on_results callbacks wrap results into the core’s message type, closing the loop without the core knowing how the effects were executed.

Types

An effect request from the pure core. The runtime interprets these.

pub type Effect(msg) {
  CallProvider(
    messages: List(message.Message),
    tools: List(tool_definition.ToolDefinition),
    on_response: fn(
      Result(provider.InferenceResult, error.AiError),
    ) -> msg,
  )
  ExecuteTools(
    calls: List(message.ToolCall),
    on_results: fn(
      List(#(message.ToolCall, Result(json.Json, tool.ToolError))),
    ) -> msg,
  )
}

Constructors

Search Document