Documentation
¶
Overview ¶
Package client implements the non-streaming A2A 1.0 JSON-RPC client.
Index ¶
- Constants
- func IsInputRequired(state string) bool
- func IsTerminal(state string) bool
- func NormalizeState(state string) string
- type AgentCard
- type CancelTaskRequest
- type Client
- func (c *Client) Answer(task *Task) string
- func (c *Client) CancelTask(ctx context.Context, taskID string) (*Task, error)
- func (c *Client) GetTask(ctx context.Context, taskID string) (*Task, error)
- func (c *Client) Options(task *Task) []string
- func (c *Client) Question(task *Task) string
- func (c *Client) SendMessage(ctx context.Context, text, contextID, taskID string) (*Task, *Message, error)
- func (c *Client) WaitTask(ctx context.Context, taskID string, interval time.Duration) (*Task, error)
- type GetTaskRequest
- type Message
- type Part
- type RPCError
- type Request
- type SendMessageRequest
- type Task
- type TaskStatus
Constants ¶
const ( MethodSendMessage = wire.MethodSendMessage MethodSendStreamingMessage = wire.MethodSendStreamingMessage MethodGetTask = wire.MethodGetTask MethodListTasks = wire.MethodListTasks MethodCancelTask = wire.MethodCancelTask MethodSubscribeToTask = wire.MethodSubscribeToTask )
const ( StateSubmitted = wire.StateSubmitted StateWorking = wire.StateWorking StateInputRequired = wire.StateInputRequired StateCompleted = wire.StateCompleted StateCanceled = wire.StateCanceled StateFailed = wire.StateFailed StateRejected = wire.StateRejected StateAuthRequired = wire.StateAuthRequired )
const ( RoleUser = wire.RoleUser RoleAgent = wire.RoleAgent )
Variables ¶
This section is empty.
Functions ¶
func IsInputRequired ¶
IsInputRequired reports whether state pauses a task for user input.
func NormalizeState ¶
NormalizeState maps A2A 0.3 lowercase states and 1.0 enum values to the 1.0 wire form.
Types ¶
type CancelTaskRequest ¶
type CancelTaskRequest = wire.CancelTaskRequest
type Client ¶
type Client struct {
Name string
Card AgentCard
Endpoint string
// contains filtered or unexported fields
}
Client is a non-streaming A2A JSON-RPC client bound to one remote agent.
func Discover ¶
func Discover(ctx context.Context, name, cardURL, token string, httpClient *http.Client) (*Client, error)
Discover fetches an Agent Card and resolves its JSON-RPC endpoint. An empty path on cardURL is treated as a base URL and gets the well-known card path appended.
func (*Client) CancelTask ¶
CancelTask requests cancellation of a running task.
func (*Client) Options ¶
Options returns the choices attached to an input-required task, when present.
func (*Client) SendMessage ¶
func (c *Client) SendMessage(ctx context.Context, text, contextID, taskID string) (*Task, *Message, error)
SendMessage sends a text message. When taskID is set the message resumes that task; otherwise a new task is started. The result is either a Task to poll or a direct Message when the remote agent answers synchronously.
type GetTaskRequest ¶
type GetTaskRequest = wire.GetTaskRequest
type SendMessageRequest ¶
type SendMessageRequest = wire.SendMessageRequest
type TaskStatus ¶
type TaskStatus = wire.TaskStatus