server

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package server implements an HTTP/gRPC A2A (Agent-to-Agent) server for pi.

It mirrors the ACP server in internal/acp/server: the same pi runtime (PromptHandler) is exposed over the A2A protocol instead of ACP. The server serves an agent card at /.well-known/agent-card.json and accepts JSON-RPC A2A message requests on the root path, plus gRPC A2A on the same port (HTTP/2 with application/grpc content type), matching the kagent Substrate runtime contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, cfg ServeConfig) error

Serve runs pi as an A2A agent over HTTP/gRPC and returns when ctx is canceled. Serve does not close the listeners; callers own them.

Types

type ServeConfig

type ServeConfig struct {
	// Addr is the HTTP/gRPC listen address. Default ":8085".
	Addr string
	// ReadyAddr is the readiness listen address. Default ":8081".
	ReadyAddr string
	// Handler processes one A2A prompt turn. Required.
	Handler acpserver.PromptHandler
	// CWD is the working directory for sessions. Empty means current dir.
	CWD string
	// TaskStore persists tasks where the kagent A2A gateway can read them.
	// When nil, tasks live in memory for the life of the process, which is
	// correct for a standalone A2A server but not behind the kagent gateway.
	TaskStore TaskStore
	// Logger receives diagnostic output. Optional.
	Logger *slog.Logger
}

ServeConfig configures a server.Serve run.

type TaskStore added in v0.3.0

type TaskStore interface {
	a2ataskstore.Store
	// Settle acknowledges that native execution stopped at version, which
	// publishes the task state and history atomically. A store that has no
	// staged boundary may treat it as a no-op.
	Settle(ctx context.Context, taskID a2a.TaskID, version a2ataskstore.TaskVersion) error
}

TaskStore persists A2A tasks and, for kagent, publishes a completed turn's boundary so the gateway can read the final result.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL