Documentation
¶
Overview ¶
Package runtime holds the protocol-neutral execution layer shared by the AG-UI and A2A servers. It turns one agent turn into a stream of events and leaves wire formatting to the protocol adapters.
Index ¶
Constants ¶
const ( EventRunStart = "run_start" EventContent = "content" EventReasoning = "reasoning" EventToolStart = "tool_start" EventToolEnd = "tool_end" EventTodos = "todos" EventInterrupt = "interrupt" EventError = "error" EventRunEnd = "run_end" )
Event types emitted by Runner.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorData ¶
type ErrorData struct {
Message string `json:"message"`
}
ErrorData reports a failed turn.
type Event ¶
type Event struct {
Seq int64 `json:"seq"`
ThreadID string `json:"thread_id"`
RunID string `json:"run_id"`
Type string `json:"type"`
Data any `json:"data,omitempty"`
}
Event is one protocol-neutral execution event.
type Interactor ¶
type Interactor interface {
Ask(ctx context.Context, data InterruptData) (Response, error)
Approve(ctx context.Context, data InterruptData) (Response, error)
Todos(ctx context.Context, data TodosData) error
}
Interactor bridges ask_user, approvals and todo updates to a protocol. Implementations may block until a client answers; the run goroutine is kept alive by the adapter while the HTTP response is parked.
type InterruptData ¶
type InterruptData struct {
ID string `json:"id"`
Kind string `json:"kind"` // question or approval
Question string `json:"question,omitempty"`
Options []string `json:"options,omitempty"`
Request approval.Request `json:"request,omitempty"`
}
InterruptData describes a question or an approval request. The protocol adapter decides how to present it and how to resume the run.
type Request ¶
type Request struct {
Agent string
Prompt string
Model string
SessionID string
// History overrides the session history when non-nil. AG-UI clients send
// the complete message list, while A2A resumes from the stored session.
History []*schema.Message
}
Request describes one agent turn.
type Response ¶
type Response struct {
Value string `json:"value,omitempty"`
Approved bool `json:"approved,omitempty"`
Remember bool `json:"remember,omitempty"`
}
Response is the answer to an interrupt.
type RunEndData ¶
type RunEndData struct {
Stop string `json:"stop"` // end, error, cancelled
SessionID string `json:"session_id"`
Answer string `json:"answer,omitempty"`
}
RunEndData reports why a turn stopped.
type RunStartData ¶
type RunStartData struct {
Agent string `json:"agent"`
Model string `json:"model"`
Session string `json:"session_id"`
}
RunStartData announces a run and the session it belongs to.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner executes agent turns and emits protocol-neutral events.
type TextData ¶
type TextData struct {
Text string `json:"text"`
}
TextData carries an incremental text or reasoning delta.
type ToolEndData ¶
type ToolEndData struct {
Name string `json:"name"`
CallID string `json:"call_id"`
Result string `json:"result"`
Failed bool `json:"failed"`
}
ToolEndData reports a completed tool call.
type ToolStartData ¶
type ToolStartData struct {
Name string `json:"name"`
CallID string `json:"call_id"`
Arguments string `json:"arguments"`
}
ToolStartData reports a tool call requested by the model.