Documentation
¶
Index ¶
- func AuthFailure(agentURL string, err error) (string, bool)
- func NewClient(agentURL string) client.A2AClient
- func PolicyRefusal(err error) (string, bool)
- func PreferredEndpointURL(card *adk.AgentCard, fallback string) string
- func Rejection(agentURL string, err error) (string, bool)
- func RouteAgent(name, configuredURL, runningAt string)
- func UnrouteAgent(name string)
- func UseGatewayCredential(gatewayURL, apiKey string)
- type AgentCardClient
- type AuthError
- type HeadlessTaskHandler
- type Server
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthFailure ¶ added in v0.226.0
AuthFailure describes err for the model when it is an authentication failure: credentials that could not be obtained, or a 401 or 403 from the agent. The message names the agent and leaves the response body out.
func NewClient ¶
NewClient returns an ADK client for the agent at agentURL whose requests carry the session's trace context, so remote spans nest under ours, and the credentials agents.yaml gives the agent. They go to the host the agent actually runs on. Every request activates the usage extension.
func PolicyRefusal ¶ added in v0.226.0
PolicyRefusal describes err for the model when the gateway's guardrails refused the request: a 403 whose body is a JSON-RPC error. The message carries the policy's own words.
func PreferredEndpointURL ¶ added in v0.222.2
PreferredEndpointURL returns the card's preferred interface URL, falling back to the URL the card was fetched from when it declares none. v1.0.1 cards replaced the flat url field with SupportedInterfaces.
func Rejection ¶ added in v0.226.0
Rejection describes err for the model when the agent turned the request down for good, so retrying is pointless: a policy refusal, an authentication failure or a method the agent does not implement.
func RouteAgent ¶ added in v0.226.0
func RouteAgent(name, configuredURL, runningAt string)
RouteAgent sends requests for the named agent, configured at configuredURL, to the host of runningAt. Running on the configured origin clears the route.
func UnrouteAgent ¶ added in v0.226.0
func UnrouteAgent(name string)
UnrouteAgent sends requests for the named agent back to its configured URL.
func UseGatewayCredential ¶ added in v0.226.0
func UseGatewayCredential(gatewayURL, apiKey string)
UseGatewayCredential makes apiKey the bearer token of A2A requests to the gateway at gatewayURL, the token the gateway also expects on inference.
Types ¶
type AgentCardClient ¶
type AgentCardClient struct {
// contains filtered or unexported fields
}
func NewAgentCardClient ¶
func NewAgentCardClient(cfg *config.Config) *AgentCardClient
func (*AgentCardClient) GetAgentCard ¶
func (*AgentCardClient) GetAgentCards ¶
func (s *AgentCardClient) GetAgentCards(ctx context.Context) ([]*a2adomain.CachedAgentCard, error)
func (*AgentCardClient) GetConfiguredAgents ¶
func (s *AgentCardClient) GetConfiguredAgents() []string
type AuthError ¶ added in v0.226.0
AuthError reports that a request to an agent could not be given credentials. Its reason names variables, URLs and status codes, never a secret.
type HeadlessTaskHandler ¶ added in v0.231.0
type HeadlessTaskHandler struct {
Runner func(ctx context.Context, opts agentheadless.Options) (agentheadless.Result, error)
Mode string
Timeout time.Duration
}
HeadlessTaskHandler runs every task it gets as one `infer headless --prompt-only` subprocess. The task's text parts are the prompt, the run's final assistant message is the completed task's status message, and a tasks/cancel reaches the run as the cancellation of its context. Timeout bounds one run so a hung one cannot hold the one-at-a-time queue forever.
func NewHeadlessTaskHandler ¶ added in v0.231.0
func NewHeadlessTaskHandler(mode string, timeout time.Duration) *HeadlessTaskHandler
NewHeadlessTaskHandler builds the handler for tasks served in the given headless agent mode, each run bounded by timeout (zero means unbounded).
func (*HeadlessTaskHandler) GetAgent ¶ added in v0.231.0
func (*HeadlessTaskHandler) GetAgent() adkserver.OpenAICompatibleAgent
GetAgent is the TaskHandler contract; see SetAgent.
func (*HeadlessTaskHandler) HandleTask ¶ added in v0.231.0
func (h *HeadlessTaskHandler) HandleTask(ctx context.Context, task *adk.Task, message *adk.Message) (*adk.Task, error)
HandleTask validates the task and runs it. Validation and run failures land in the task's status rather than in the error return, so the state set here is what the client polls. A task whose context was canceled keeps the canceled state the task manager already recorded.
func (*HeadlessTaskHandler) SetAgent ¶ added in v0.231.0
func (*HeadlessTaskHandler) SetAgent(adkserver.OpenAICompatibleAgent)
SetAgent is the TaskHandler contract; a served task never calls the ADK's OpenAI-compatible agent.
type Server ¶ added in v0.231.0
type Server struct {
// contains filtered or unexported fields
}
Server is the A2A server the daemon hosts: the agent card plus the message/send, tasks/{get,list,cancel} methods, tasks kept in the ADK's in-memory store and run one at a time from its queue, each one a headless run.
func NewServer ¶ added in v0.231.0
NewServer builds the ADK A2A server around infer's values. The ADK reads no environment of its own: serverConfig.NewWithDefaults applies only its struct-tag defaults, so an unprefixed SERVER_PORT or AUTH_ENABLED in the user's shell is never read, and every knob is set from settings.
type Settings ¶ added in v0.231.0
type Settings struct {
Host string
Port int
Token string
Mode string
TaskTimeout time.Duration
Version string
}
Settings carries what the daemon passes over: the bind address, the port, the bearer token, the agent mode and time budget served tasks run with, and the card version.