Documentation
¶
Overview ¶
Package acp holds Lagrange's conventions for coding agents served with a2aacp (tunnel --acp, or an executor of your own), so that every Lagrange client sees what such an agent does, not only the machine that runs it.
- Tool calls: a working status message when a call starts, not only when it finishes, each with a {"toolCall": {...}} data part (id, title, kind, status, input, and the output once it finished). The relay records that part in the activity log.
- Usage: the agent's token and cost reports, as a status message with a {"usage": {...}} data part (see Usage).
- Thoughts: with Options.Thoughts, the agent's thinking streams into the ThoughtsArtifact artifact. Its reply streams into "response" as before.
Wrap the converter of your a2aacp.Config with Converter:
cfg := &a2aacp.Config{Converter: acp.Converter(nil, acp.Options{Thoughts: true})}
Index ¶
Constants ¶
const ( // ToolCallKey is the data part key of a tool call: {"toolCall": {"id", "title", // "kind", "status", "input", "output"}}. a2aacp uses the same shape. ToolCallKey = "toolCall" // UsageKey is the data part key of a usage report: {"usage": {...}}. UsageKey = "usage" // ThoughtsArtifact is the name of the artifact the agent's thinking streams // into, with Options.Thoughts. ThoughtsArtifact = "thoughts" // StatusRunning is the toolCall status of a call that started. StatusRunning = "in_progress" // MaxOutput caps a finished tool call's output, in bytes; the end is kept. MaxOutput = 4096 )
Keys and names this package writes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// Thoughts streams the agent's thinking into the thoughts artifact. Each
// chunk is an event, so it costs activity log space.
Thoughts bool
}
Options select what Converter adds to a2aacp's built-in conversion.
type Usage ¶
type Usage struct {
// Used is the number of tokens in the context window, Size the window's size.
Used int64 `json:"used,omitempty"`
Size int64 `json:"size,omitempty"`
// Cost is the session's cost so far (for claude-agent-acp, Claude Code's
// estimate at API prices).
Cost *Cost `json:"cost,omitempty"`
}
Usage is an agent's usage report for its session (the A2A context), as the agent sends it: Cost is cumulative over the session, so the session's cost is its latest report.
func ParseUsage ¶
ParseUsage reads a usage data part's value ({"used", "size", "cost"}), as found in a message or an activity entry's data.