Documentation
¶
Index ¶
- Constants
- func AgentCardSignatureKeyID(signature AgentCardSignature) (string, error)
- func CreateOrlojTaskFromA2A(params TaskSendParams, system string, namespace string) resources.Task
- func CreateOrlojTaskFromV1(req *lf.SendMessageRequest, system, namespace string) (resources.Task, error)
- func IsTerminal(state string) bool
- func IsV1Error(err error) bool
- func LoadPEMCardPublicKey(path string) (crypto.PublicKey, error)
- func MarshalV1Metadata(value map[string]any) string
- func OrlojPhaseToA2AState(task resources.Task) string
- func OrlojPhaseToV1State(task resources.Task) lf.TaskState
- func OrlojTaskToV1(task resources.Task) *lf.Task
- func V1MessageText(message *lf.Message) (string, error)
- func VerifyAgentCardSignature(card AgentCard, signature AgentCardSignature, publicKey crypto.PublicKey) error
- type AgentCard
- type AgentCardSignature
- type AgentInterface
- type CardAuth
- type CardCapabilities
- type CardExtension
- type CardGeneratorConfig
- type CardKeyResolver
- type CardProvider
- type CardSigner
- type CardSkill
- type Client
- func (c *Client) CacheStatus(agentURL string) (lastRefreshed time.Time, hasError bool)
- func (c *Client) CancelTask(ctx context.Context, agentURL string, params TaskCancelParams, ...) (TaskResult, error)
- func (c *Client) FetchCard(ctx context.Context, agentURL string, extraHeaders map[string]string) (AgentCard, error)
- func (c *Client) GetTask(ctx context.Context, agentURL string, params TaskGetParams, ...) (TaskResult, error)
- func (c *Client) SendTask(ctx context.Context, agentURL string, params TaskSendParams, ...) (TaskResult, error)
- type ClientConfig
- type JSONRPCError
- type JSONRPCRequest
- type JSONRPCResponse
- type Registry
- type RegistryResponse
- type RemoteAgentConfig
- type RemoteAgentEntry
- type SafePushSender
- type TaskArtifact
- type TaskArtifactEvent
- type TaskCancelParams
- type TaskGetParams
- type TaskMessage
- type TaskPart
- type TaskResult
- type TaskSendParams
- type TaskStatus
- type TaskStatusEvent
- type ToolRuntime
Constants ¶
const ( LabelA2ATaskID = "orloj.dev/a2a-task-id" LabelA2AContextID = "orloj.dev/a2a-context-id" LabelA2AClient = "orloj.dev/a2a-client" LabelA2ACancelled = "orloj.dev/a2a-cancelled" LabelBlockedReason = "orloj.dev/blocked-reason" BlockedReasonA2AInput = "a2a-input-required" BlockedKindA2AInput = "A2AInputRequest" )
A2A label keys used on Orloj Tasks for A2A correlation.
const ( ErrCodeParse = -32700 ErrCodeInvalidRequest = -32600 ErrCodeMethodNotFound = -32601 ErrCodeInvalidParams = -32602 ErrCodeInternal = -32603 ErrCodeTaskNotFound = -32001 ErrCodeTaskCancelled = -32002 ErrCodeAgentNotFound = -32003 )
Standard JSON-RPC error codes
const ( TaskStateSubmitted = "submitted" TaskStateWorking = "working" TaskStateInputRequired = "input-required" TaskStateCompleted = "completed" TaskStateFailed = "failed" TaskStateCanceled = "canceled" TaskStateRejected = "rejected" )
A2A Task states
const ( MethodTaskSend = "tasks/send" MethodTaskGet = "tasks/get" MethodTaskCancel = "tasks/cancel" MethodTaskSubscribe = "tasks/sendSubscribe" )
A2A method names (current and legacy)
const ( LabelA2AMessageID = "orloj.dev/a2a-message-id" LabelA2AProtocolVersion = "orloj.dev/a2a-protocol-version" )
Variables ¶
This section is empty.
Functions ¶
func AgentCardSignatureKeyID ¶ added in v0.19.0
func AgentCardSignatureKeyID(signature AgentCardSignature) (string, error)
AgentCardSignatureKeyID returns the protected JWS kid value.
func CreateOrlojTaskFromA2A ¶
func CreateOrlojTaskFromA2A(params TaskSendParams, system string, namespace string) resources.Task
CreateOrlojTaskFromA2A builds an Orloj Task from an A2A send request.
func CreateOrlojTaskFromV1 ¶ added in v0.19.0
func CreateOrlojTaskFromV1(req *lf.SendMessageRequest, system, namespace string) (resources.Task, error)
CreateOrlojTaskFromV1 builds an Orloj task from a normative A2A v1 request. The A2A task and context IDs are generated server-side when omitted.
func IsTerminal ¶
IsTerminal returns true if the A2A state represents a terminal condition.
func IsV1Error ¶ added in v0.19.0
IsV1Error reports whether err belongs to the normative A2A error taxonomy.
func LoadPEMCardPublicKey ¶ added in v0.19.0
LoadPEMCardPublicKey loads a PKIX, PKCS#1 RSA, or certificate public key.
func MarshalV1Metadata ¶ added in v0.19.0
MarshalV1Metadata preserves arbitrary A2A metadata in string-only Orloj fields when an adapter needs to persist it.
func OrlojPhaseToA2AState ¶
OrlojPhaseToA2AState converts an Orloj Task phase to an A2A task state.
func OrlojPhaseToV1State ¶ added in v0.19.0
OrlojPhaseToV1State converts Orloj phases to A2A v1 enum values.
func OrlojTaskToV1 ¶ added in v0.19.0
OrlojTaskToV1 converts an Orloj task to the normative A2A v1 task shape.
func V1MessageText ¶ added in v0.19.0
V1MessageText converts a v1 message into Orloj's text task input.
Orloj currently advertises text/plain input. Rejecting other part types is preferable to silently dropping content that could affect the requested work.
func VerifyAgentCardSignature ¶ added in v0.19.0
func VerifyAgentCardSignature(card AgentCard, signature AgentCardSignature, publicKey crypto.PublicKey) error
VerifyAgentCardSignature verifies one signature against a public key.
Types ¶
type AgentCard ¶
type AgentCard struct {
Name string `json:"name"`
Description string `json:"description"`
URL string `json:"url,omitempty"`
Version string `json:"version"`
ProtocolVersion string `json:"protocolVersion,omitempty"`
SupportedInterfaces []AgentInterface `json:"supportedInterfaces"`
Capabilities CardCapabilities `json:"capabilities"`
DefaultInputModes []string `json:"defaultInputModes"`
DefaultOutputModes []string `json:"defaultOutputModes"`
Skills []CardSkill `json:"skills"`
Authentication *CardAuth `json:"authentication,omitempty"`
SecuritySchemes map[string]map[string]any `json:"securitySchemes,omitempty"`
SecurityRequirements []map[string][]string `json:"securityRequirements,omitempty"`
Signatures []AgentCardSignature `json:"signatures,omitempty"`
Provider *CardProvider `json:"provider,omitempty"`
}
AgentCard represents an A2A Agent Card as defined by the A2A protocol.
func GenerateAgentCard ¶
func GenerateAgentCard(agent resources.Agent, tools []resources.Tool, config CardGeneratorConfig) AgentCard
GenerateAgentCard builds an A2A Agent Card from an Orloj Agent and its tools.
func GenerateSystemCard ¶
func GenerateSystemCard(system resources.AgentSystem, agents []resources.Agent, tools []resources.Tool, config CardGeneratorConfig) AgentCard
GenerateSystemCard builds a card from an AgentSystem. It aggregates skills from all agents in the system.
func SignAgentCard ¶ added in v0.19.0
func SignAgentCard(card AgentCard, signer CardSigner) (AgentCard, error)
SignAgentCard returns a card with a newly appended signature. Existing signatures are excluded from the signed payload, as required by A2A.
func (AgentCard) EffectiveProtocolVersion ¶ added in v0.19.0
EffectiveProtocolVersion returns the preferred interface version while retaining compatibility with cards that only carry the legacy top-level field.
func (AgentCard) PreferredInterface ¶ added in v0.19.0
func (c AgentCard) PreferredInterface(binding, version string) (AgentInterface, bool)
PreferredInterface returns the first matching interface in server preference order. Empty binding or version values do not constrain selection.
type AgentCardSignature ¶ added in v0.19.0
type AgentInterface ¶ added in v0.19.0
type CardCapabilities ¶
type CardCapabilities struct {
Streaming bool `json:"streaming,omitempty"`
PushNotifications bool `json:"pushNotifications,omitempty"`
ExtendedAgentCard bool `json:"extendedAgentCard,omitempty"`
StateTransitions bool `json:"stateTransitionHistory,omitempty"`
Extensions []CardExtension `json:"extensions,omitempty"`
}
type CardExtension ¶ added in v0.19.0
type CardGeneratorConfig ¶
type CardGeneratorConfig struct {
PublicBaseURL string
GRPCPublicURL string
ProtocolVersion string
AgentVersion string
StreamingEnabled bool
WebhooksEnabled bool
AuthSchemes []string
AdditionalInterfaces []AgentInterface
Namespace string
}
CardGeneratorConfig controls Agent Card generation.
type CardKeyResolver ¶ added in v0.19.0
CardKeyResolver resolves a trusted public key for a protected JWS kid.
type CardProvider ¶
type CardSigner ¶ added in v0.19.0
type CardSigner interface {
Sign(card AgentCard) (AgentCardSignature, error)
}
CardSigner signs the RFC 8785 canonical representation of an Agent Card using the detached-payload JWS form defined by the A2A specification.
func LoadPEMCardSigner ¶ added in v0.19.0
func LoadPEMCardSigner(path, keyID string) (CardSigner, error)
LoadPEMCardSigner loads an RSA, P-256 ECDSA, or Ed25519 private key.
func NewPEMCardSigner ¶ added in v0.19.0
func NewPEMCardSigner(data []byte, keyID string) (CardSigner, error)
NewPEMCardSigner creates a signer from PKCS#8, PKCS#1, or SEC1 PEM data.
type CardSkill ¶
type CardSkill struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
InputSchema map[string]any `json:"inputSchema,omitempty"`
InputModes []string `json:"inputModes,omitempty"`
OutputModes []string `json:"outputModes,omitempty"`
Examples []string `json:"examples,omitempty"`
Tags []string `json:"tags"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles outbound A2A requests to remote agents.
func NewClient ¶
func NewClient(config ClientConfig) *Client
NewClient creates a new outbound A2A client with SSRF-safe HTTP.
func (*Client) CacheStatus ¶
CacheStatus returns info about a cached card entry for observability.
func (*Client) CancelTask ¶
func (c *Client) CancelTask(ctx context.Context, agentURL string, params TaskCancelParams, extraHeaders map[string]string) (TaskResult, error)
CancelTask cancels a task on a remote A2A agent.
func (*Client) FetchCard ¶
func (c *Client) FetchCard(ctx context.Context, agentURL string, extraHeaders map[string]string) (AgentCard, error)
FetchCard retrieves and caches a remote Agent Card. Optional extraHeaders are applied to the HTTP request (e.g. auth).
type ClientConfig ¶
type ClientConfig struct {
AllowPrivate bool
CardCacheTTL time.Duration
RequireSignedCards bool
ResolveCardKey CardKeyResolver
}
ClientConfig configures the outbound A2A client.
type JSONRPCError ¶
type JSONRPCRequest ¶
type JSONRPCRequest struct {
JSONRPC string `json:"jsonrpc"`
ID any `json:"id"`
Method string `json:"method"`
Params any `json:"params,omitempty"`
}
JSON-RPC types
type JSONRPCResponse ¶
type JSONRPCResponse struct {
JSONRPC string `json:"jsonrpc"`
ID any `json:"id"`
Result any `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maintains a cache of remote A2A agent cards.
func NewRegistry ¶
func NewRegistry(client *Client, configs []RemoteAgentConfig, ttl time.Duration, logger *log.Logger) *Registry
NewRegistry creates a registry backed by static config.
func (*Registry) Get ¶
func (r *Registry) Get(name string) (RemoteAgentEntry, bool)
Get returns a specific remote agent entry by name.
func (*Registry) List ¶
func (r *Registry) List() []RemoteAgentEntry
List returns all registered remote agents with their cache status, sorted by name.
type RegistryResponse ¶
type RegistryResponse struct {
LocalAgents []AgentCard `json:"localAgents"`
RemoteAgents []RemoteAgentEntry `json:"remoteAgents"`
}
RegistryResponse is the response for GET /v1/a2a/agents
type RemoteAgentConfig ¶
type RemoteAgentConfig struct {
Name string `json:"name" yaml:"name"`
URL string `json:"url" yaml:"url"`
AuthType string `json:"authType,omitempty" yaml:"authType,omitempty"`
SecretRef string `json:"secretRef,omitempty" yaml:"secretRef,omitempty"`
}
RemoteAgentConfig defines a static remote agent entry from Helm/server config.
type RemoteAgentEntry ¶
type RemoteAgentEntry struct {
Name string `json:"name"`
URL string `json:"url"`
ProtocolVersion string `json:"protocolVersion,omitempty"`
CacheStatus string `json:"cacheStatus,omitempty"`
LastRefreshed string `json:"lastRefreshed,omitempty"`
CacheTTL string `json:"cacheTTL,omitempty"`
Error string `json:"error,omitempty"`
Card *AgentCard `json:"card,omitempty"`
}
RemoteAgentEntry represents a configured remote A2A agent in the registry.
type SafePushSender ¶ added in v0.19.0
type SafePushSender struct {
// contains filtered or unexported fields
}
SafePushSender delivers A2A task events while enforcing Orloj's dial-time SSRF policy, including DNS rebinding protection.
func NewSafePushSender ¶ added in v0.19.0
func NewSafePushSender(allowPrivate bool, timeout time.Duration) *SafePushSender
func (*SafePushSender) SendPush ¶ added in v0.19.0
func (s *SafePushSender) SendPush(ctx context.Context, config *lf.PushConfig, event lf.Event) error
type TaskArtifact ¶
type TaskArtifactEvent ¶
type TaskArtifactEvent struct {
ID string `json:"id"`
Artifact TaskArtifact `json:"artifact"`
}
type TaskCancelParams ¶
type TaskGetParams ¶
type TaskMessage ¶
type TaskResult ¶
type TaskResult struct {
ID string `json:"id"`
Status TaskStatus `json:"status"`
Artifacts []TaskArtifact `json:"artifacts,omitempty"`
History []TaskMessage `json:"history,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
func OrlojTaskToA2AResult ¶
func OrlojTaskToA2AResult(task resources.Task) TaskResult
OrlojTaskToA2AResult converts an Orloj Task to an A2A TaskResult.
type TaskSendParams ¶
type TaskSendParams struct {
ID string `json:"id"`
Message TaskMessage `json:"message"`
Metadata map[string]string `json:"metadata,omitempty"`
HistoryLength *int `json:"historyLength,omitempty"`
}
A2A Task types
type TaskStatus ¶
type TaskStatus struct {
State string `json:"state"`
Message *TaskMessage `json:"message,omitempty"`
}
type TaskStatusEvent ¶
type TaskStatusEvent struct {
ID string `json:"id"`
Status TaskStatus `json:"status"`
Final bool `json:"final,omitempty"`
}
SSE event types
type ToolRuntime ¶
type ToolRuntime struct {
// contains filtered or unexported fields
}
ToolRuntime executes outbound A2A tool calls against remote agents.
func NewToolRuntime ¶
func NewToolRuntime(client *Client, registry agentruntime.ToolCapabilityRegistry, secrets agentruntime.SecretResolver) *ToolRuntime
NewToolRuntime creates an A2A tool runtime. If secrets is non-nil, auth injection for tools with spec.auth is enabled automatically.
func (*ToolRuntime) WithNamespace ¶
func (r *ToolRuntime) WithNamespace(namespace string) agentruntime.ToolRuntime
WithNamespace returns a copy scoped to the given namespace.
func (*ToolRuntime) WithRegistry ¶
func (r *ToolRuntime) WithRegistry(registry agentruntime.ToolCapabilityRegistry) agentruntime.ToolRuntime
WithRegistry returns a copy scoped to the given registry.