Documentation
¶
Overview ¶
Package agentclient is the runtime-side client to the daemon's agent-to-agent linking RPCs. It exposes the four agent-facing calls the LLM tools (agent_list / agent_info / agent_chat / agent_exec) need; the daemon enforces "target ∈ JWT.Links" on every call.
Configuration parallels pkg/jobsclient — OTTERSD_URL + OTTERS_AGENT_TOKEN planted in the spawn env by the executor. Both clients share the underlying gRPC channel topology and auth shape; the package boundary just keeps each client focused on one daemon surface (jobs vs links) for readability.
Index ¶
Constants ¶
const ( EnvDaemonURL = "OTTERSD_URL" // EnvAgentToken is the spawn-env var that carries the agent's // JWT. The string is an env-var NAME, not a credential — the // actual token value lives only in process memory. EnvAgentToken = "OTTERS_AGENT_TOKEN" //nolint:gosec // G101: env var name, not a literal credential. )
Env names — same vars jobsclient reads. Re-exported so tests don't pull jobsclient in just for the constant.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentInfoView ¶
type AgentInfoView struct {
AgentView
Description string `json:"description,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
}
AgentInfoView is the richer payload for agent_info. Adds description (the target's `description` label) + the list of capabilities the target exposes so the calling agent can decide whether it's the right delegate.
type AgentView ¶
type AgentView struct {
ID string `json:"id"`
Name string `json:"name"`
Model string `json:"model"`
Status string `json:"status"`
}
AgentView is the agent-facing snapshot of one linked agent. Mirrors the proto LinkedAgent with JSON tags so the runtime can return it directly as the tool response payload.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps daemonv1.RuntimeClient with bearer-token injection and lazy dialing. Safe for concurrent use.
func (*Client) AgentExec ¶
func (c *Client) AgentExec( ctx context.Context, ref, prompt, sessionID string, ) (string, string, error)
AgentExec sends a prompt to the target and blocks until the target's turn finishes. sessionID is optional; pass an empty string for a fresh session, or thread the returned id through subsequent calls to preserve history on the target. Returns (response, returnedSessionID, err).
(agent_chat existed as a separate threaded variant in alpha.82–.84; folded back into AgentExec in alpha.85 — one shape covers both use cases.)
func (*Client) AgentInfo ¶
AgentInfo returns the target's metadata + capabilities. PermissionDenied if the target isn't in the caller's JWT.Links.