Agent Protocol Documentation

repository·main·Indexed 23 days ago

https://github.com/agi-inc/agent-protocol

A tech-stack agnostic API specification for communicating with AI agents. It provides a standardized interface for task creation and execution to simplify agent integration, benchmarking, and tool development. The project includes SDKs and client libraries for JavaScript/TypeScript and Python, allowing developers to either wrap agents in a protocol-compliant web server or interact with compliant agents via a common API.

Tokens
29.8K
Snippets
65
Records
169
Agent score
78%

What's inside Agent Protocol

  1. Explore projects and tools using Agent Protocol

    main

    The Agent Protocol ecosystem includes various agents, clients, and tools designed to work with the standard communication specification.

    Agents

    • AutoGPT: An experimental open-source attempt to make GPT-4 fully autonomous.
    • Smol developer: A junior developer agent.
    • waggledance.ai: An open-source multi-agent execution environment that implements the Agent Protocol OpenAPI spec.

    Clients

    • AutoGPT UI: A Flutter app designed for discussing tasks with a single agent.

    Tools

    • Benchmarking: A client built for benchmarking agent performance regardless of their internal implementation.
    • SDK: Official SDKs available in Python and JS/TS.
    • Client: A dedicated Python client for interacting with Agent Protocol servers.
    • AutoGPT Forge: Building blocks for creating AutoGPT-style agents using the protocol.
  2. Benefits of adopting the Agent Protocol

    main

    Adopting the Agent Protocol provides several advantages for developers building AI agents:

    • Benchmarking Integration: Agents using the protocol can be easily tested and benchmarked using existing tools like Auto-GPT-Benchmarks and Agent Evals.
    • Interoperability: Standardizing on the protocol allows other developers to integrate your agent using existing SDKs, clients, and UIs without custom glue code.
    • Ecosystem Support: A standardized interface enables the creation of general-purpose developer tools for development, deployment, and monitoring that work out-of-the-box.
    • Reduced Boilerplate: Developers can focus on core agent logic rather than writing custom API layers for integration, deployment, or monitoring.
  3. What is the Agent Protocol?

    main
    The Agent Protocol is a tech-stack agnostic API specification that provides a common interface for communicating with AI agents. It defines a set of standard REST API endpoints and response models, allowing different agents to be easily compared, benchmarked, and integrated with general-purpose developer tools (such as monitoring and deployment platforms) without custom boilerplate for every implementation.
  4. What is the Agent Protocol and why use it?

    main

    The Agent Protocol (AP) is a standardized, tech-stack-agnostic API specification designed to provide a common interface for communicating with AI agents.

    By implementing this protocol, agent developers ensure their agents can be easily compared, integrated with various developer tools, and controlled by different clients without custom integration code for every new agent. The protocol treats an agent as an application that receives tasks, plans steps, and produces artifacts, allowing users to monitor progress and maintain control over execution.

  5. What is Agent Protocol?

    main
    Agent Protocol is an open-source, tech-stack-agnostic API specification designed to provide a single common interface for communicating with AI agents. It solves the problem of fragmented agent interfaces by defining a standard set of endpoints and predefined input/response models. This allows developers to build agents that are easily comparable and compatible with a wide range of devtools.
  6. Environment and Compatibility for agent-protocol-client

    main

    The agent-protocol-client is a TypeScript/JavaScript client generated to use the Fetch API.

    Supported Environments

    • Node.js
    • Webpack
    • Browserify

    Language and Module Support

    • Language Levels: ES5 (requires a Promises/A+ library) and ES6.
    • Module Systems: CommonJS and ES6 module system.
    • Typings: Works in both TypeScript and JavaScript. In TypeScript, definitions are automatically resolved via package.json.
  7. Identify agent-generated artifacts via agent_created field

    main
    The protocol includes an agent_created field in the artifact response body. This boolean field allows developers to distinguish between artifacts produced directly by the agent and those that were already present or provided externally. Using this field enables agent builders to provide transparency to users regarding which parts of a task were autonomously generated.
  8. Core concepts of the Agent Protocol: Tasks, Steps, and Artifacts

    main

    The Agent Protocol is an OpenAPI v3 specification designed to standardize interactions with AI agents. It is built around three primary abstractions:

    1. Task: Represents a specific goal for the agent (e.g., "Create a file named hello.txt"). A task contains an input prompt, optional additional input, a sequence of steps, and produced artifacts.
    2. Step: Represents a single action performed by the agent to progress toward a task goal. Steps are triggered via the agent's API. Each step has a status (created or completed), an output, and can produce artifacts.
    3. Artifact: Represents a file that the agent has worked with or produced within its workspace. It is identified by a filename and a relative path.
  9. List tasks, artifacts, and steps using pagination

    main
    The protocol supports listing resources (such as tasks, artifacts, and steps) in a paginated manner. Instead of retrieving a list of IDs and then making individual calls for each resource's details, the proposed design allows for a single request to return an array of objects representing the resources directly. This enables efficient building of index views or tables in client applications.
  10. How the Python Agent Protocol SDK architecture works

    main

    The SDK is centered around the Agent class. To implement your agent, you use the Agent.setup_agent method, which requires two primary handlers:

    1. task_handler: A function called when a new task is created. Its responsibility is to create the initial step(s) for the task using Agent.db.create_step.
    2. step_handler: A function called when a next step is triggered. It handles the execution of a step and can create, remove, or reorder subsequent steps. By default, the SDK selects the first step with a status of created.

    Data Persistence: The Agent class provides a db attribute, which is an instance used for storing and retrieving data. The default implementation is in-memory, but you can replace it with a custom implementation for persistent storage.

    Extensibility: The package exports a router object (an instance of FastAPI's APIRouter). You can extend or override existing endpoints, such as the POST /agent/tasks/{task_id}/steps endpoint, to change how steps are selected.

  11. Paginate tasks, artifacts, and steps via query parameters

    main

    To prevent large payloads and improve performance when retrieving lists of tasks, artifacts, or steps, the protocol supports pagination via query parameters. This allows developers to request specific subsets of data rather than the entire collection at once.

    Currently, pagination is implemented using query parameters in the request URL. Note that while this RFC introduces pagination for requests, the inclusion of pagination metadata (like total pages or current page) in the response body is handled in a separate specification.

  12. How the Agent Protocol SDK architecture works

    main

    The SDK is centered around an Agent class. To implement your agent, you use the setup_agent method (or the high-level handleTask pattern) which relies on two primary handlers:

    1. task_handler: A function called when a new task is created. It receives a TaskInput and must return a step_handler.
    2. step_handler: A function called when a next step is triggered. It receives a StepInput and must return a StepResult.