Skip to main content

Open Agent Protocol — a routing layer for inter-agent task handoff

Project description

OAP — Open Agent Protocol

A lightweight routing layer for passing tasks between AI agents.

OAP defines a standard envelope format (TaskEnvelope) and a router that dispatches tasks to the right agent based on capabilities or explicit handoff instructions.

Installation

pip install open-agent-protocol

Quick start

from oap import TaskEnvelope, OAPRouter
from oap.adapters.http import HTTPAdapter

router = OAPRouter()
router.register(
    "research-agent",
    HTTPAdapter(agent_id="research-agent", base_url="http://localhost:9000"),
    capabilities=["research", "search", "find"],
)

envelope = TaskEnvelope(goal="research the best vector databases")
result = await router.route(envelope)
print(result.memory["last_result"])

CLI

# Create a new task envelope
oap init "research the best vector databases" --output task.json

# Register an HTTP agent in the local registry
oap register research-agent http://localhost:9000 --capabilities "research,search,find"

# Route the envelope to the best matching agent
oap route task.json --output result.json

# Automatically follow handoffs until the task is complete
oap chain task.json --output final.json

# Inspect an envelope
oap inspect result.json

# Validate envelope structure
oap validate result.json

# List all registered agents
oap agents

# Remove an agent from the registry
oap unregister research-agent

Chaining agents

When an agent sets a handoff.next_agent on its response, oap chain automatically routes to the next agent and keeps going until the task is complete or a hop limit is reached.

# Python API
result, visited = await router.chain(envelope, max_hops=10)
print(" → ".join(visited))  # e.g. research-agent → summarise-agent
# CLI — follows handoffs automatically, prints each hop
oap chain task.json --output final.json --max-hops 5

The chain stops when:

  • An agent returns a response with no handoff set, or
  • max_hops is reached (default: 10)

Registry

Agents are stored in ~/.oap/agents.json and persist across commands.

oap register my-agent http://localhost:9000 --capabilities "research,find"
oap agents       # list all registered agents
oap unregister my-agent

Concepts

  • TaskEnvelope — the standard task object passed between agents. Contains the goal, memory, steps taken, and optional constraints.
  • OAPRouter — selects the best registered agent for a given envelope and invokes it.
  • AgentAdapter — translates between the envelope format and an agent's native interface.
  • HTTPAdapter — built-in adapter for agents that expose a POST /invoke endpoint.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

open_agent_protocol-0.2.2.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

open_agent_protocol-0.2.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file open_agent_protocol-0.2.2.tar.gz.

File metadata

  • Download URL: open_agent_protocol-0.2.2.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for open_agent_protocol-0.2.2.tar.gz
Algorithm Hash digest
SHA256 5b10cbeff5f6fc4d85d5e062c77a954697f37d0144c56c0b08378f3d8e20efbf
MD5 c3985eab6360d2b6a0e920d912b7dc42
BLAKE2b-256 7216c7418f578d8610a4772e0d1b3be18dd14b88b7d80d719bedb01843d56962

See more details on using hashes here.

File details

Details for the file open_agent_protocol-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for open_agent_protocol-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 506c8d48dbcb30eb8aa1ae652dee78f048dc96a56832219bc49f7b9af71b5485
MD5 6456b85bee7f5e6becca70da324c3a1d
BLAKE2b-256 135625d4e79e22bb994f4a9a2b0bfd0c868569c35bc46c004afcb772cbc085df

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page