agent

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type A2AAgent

type A2AAgent struct {
	// contains filtered or unexported fields
}

A2AAgent bridges AX's Agent interface to an A2A-protocol agent.

func NewA2AAgent

func NewA2AAgent(ctx context.Context, config A2AAgentConfig) (*A2AAgent, error)

func (*A2AAgent) Card

func (a *A2AAgent) Card() *a2a.AgentCard

Card returns the resolved AgentCard for this agent.

func (*A2AAgent) Close

func (a *A2AAgent) Close() error

Close releases the underlying A2A client's resources.

func (*A2AAgent) Connect

func (a *A2AAgent) Connect(
	ctx context.Context,
	conversationID string,
	execID string,
	start *proto.AgentStart,
	e agent.Executor,
	o agent.OutputHandler,
) error

Connect bridges one AX execution to one A2A operation.

Two paths:

  1. Resume an existing in-flight task. This covers HITL continuation: the user has supplied an answer to a ConfirmationContent we previously emitted.

  2. New A2A operation.

func (*A2AAgent) HealthCheck

func (a *A2AAgent) HealthCheck(ctx context.Context) error

HealthCheck performs a lightweight call to verify the agent is reachable. Uses GetExtendedAgentCard which is supported by all A2A-compliant agents.

type A2AAgentConfig

type A2AAgentConfig struct {
	ID                string
	Address           string
	Auth              auth.Auth
	Headers           auth.Headers
	Stateless         bool
	OverrideCardHosts bool
}

A2AAgentConfig is the per-agent configuration needed to construct an A2AAgent.

Stateless controls how the bridge composes outgoing A2A messages:

  • false (default, "stateful"): the bridge sends only the new user input each turn and relies on the agent server using contextId to load conversation history from its own session store. This matches the A2A protocol convention.

  • true: the bridge sends the full AX message history on every call. Use this when targeting an A2A agent that does not maintain its own per-context state.

type ColabAgent

type ColabAgent struct {
	// contains filtered or unexported fields
}

ColabAgent implements the Agent interface by executing a Python file or Jupyter notebook on a remote Google Colab session via the colab CLI.

Each Connect() call provisions a new ephemeral Colab session, sets up the environment (drive mount, package installation), uploads the file (if local), executes it with user input, and tears the session down on completion.

Two execution modes are supported:

  • Python scripts (.py): executed via !python with input passed as a CLI flag.
  • Notebooks (.ipynb): executed via %run with input set as a Python variable.

func NewColabAgent

func NewColabAgent(config ColabAgentConfig) (*ColabAgent, error)

NewColabAgent creates a new ColabAgent. It validates that the colab CLI binary is available in PATH and that exactly one of LocalFile or RemoteFile is set.

func (*ColabAgent) Close

func (a *ColabAgent) Close() error

Close stops all currently active Colab sessions. This handles the case where Close() is called (e.g. via SIGINT) while one or more Connect() calls are mid-execution. In ax serve mode, multiple concurrent Connect() calls may each have their own session.

func (*ColabAgent) Connect

func (a *ColabAgent) Connect(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e agent.Executor, o agent.OutputHandler) error

Connect provisions a Colab session, runs user code, and tears it down, retrying once if the session is lost mid-run (e.g. idle timeout).

type ColabAgentConfig

type ColabAgentConfig struct {
	ID              string
	LocalFile       string // Path to a local .py or .ipynb file (uploaded to VM)
	DriveFile       string // Path to .ipynb file in Google Drive (e.g. MyDrive/notebooks/nb.ipynb)
	Accelerator     string // Accelerator type (optional), e.g. "tpu-v5e1", "gpu-A100"
	DriveMountPath  string // Path to mount Google Drive (optional), default: "/content/drive"
	Requirements    string // Path to requirements.txt (optional)
	InputFlag       string // Name of the input parameter (optional). For .py files, passed as --<name>. For .ipynb, set as a variable before %run
	OutputImage     string // Local path to download the output image to
	OutputDrivePath string // Google Drive path to save converted .ipynb (e.g. MyDrive/notebooks/out.ipynb)
}

ColabAgentConfig configures a Colab agent.

Jump to

Keyboard shortcuts

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