Skip to main content

Task routing layer for production AI agents — dispatch to the right agent by capability, health, and policy

Project description

agentgrid-py

Task routing for production AI agents. Given a task, AgentGrid finds the right agent from your registry based on capabilities, health, and policy — then dispatches.

Install

pip install agentgrid-py
pip install "agentgrid-py[registry]"   # with agentregistry-py
pip install "agentgrid-py[all]"        # with registry + mesh + policy

Quickstart

import asyncio
from agentgrid import AgentGrid
from agentregistry import AgentRegistry, AgentManifest

async def main():
    registry = AgentRegistry()
    registry.publish(AgentManifest(
        id="acme.search-agent", version="1.0.0",
        capabilities=["search", "summarize"],
        framework="langgraph",
    ))

    grid = AgentGrid(registry=registry)

    # Register handler for local dispatch
    async def search_handler(task: str, payload: dict) -> dict:
        return {"output": f"search results for: {task}"}
    grid.register("acme.search-agent", search_handler)

    # Route task to best agent
    result = await grid.route("find quarterly revenue", requires=["search"])
    print(f"Routed to: {result.agent_id} (score={result.score:.2f})")
    print(f"Response: {result.response}")

asyncio.run(main())

Routing Strategies

from agentgrid import RoutingStrategy

# Best capability match (default)
result = await grid.route(task, strategy=RoutingStrategy.BEST_MATCH)

# Round-robin across eligible agents
result = await grid.route(task, strategy=RoutingStrategy.ROUND_ROBIN)

# Least loaded agent
result = await grid.route(task, strategy=RoutingStrategy.LEAST_LOADED)

# Broadcast to all eligible agents
results = await grid.broadcast(task, requires=["handle_event"])

Stack

agentgrid    → routing       which agent handles what task
agentmesh    → events        connects agents via pub/sub
agentplane   → policy        governs agent behaviour
agentregistry → discovery    what agents exist and their capabilities

Apache 2.0 · PyPI

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

agentgrid_py-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

agentgrid_py-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file agentgrid_py-0.1.0.tar.gz.

File metadata

  • Download URL: agentgrid_py-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentgrid_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bc357c2d1c1ea85ffc6455317de8661ffd42d16a06ad4cc8b32ef3ade494f6e3
MD5 4b55bc6fdf19eb9af4a63fff047d734f
BLAKE2b-256 7b5a8c162bd0b23cc301d8a92f8a2653341bd1b5375178784356a87aabff7f6f

See more details on using hashes here.

File details

Details for the file agentgrid_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agentgrid_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentgrid_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c90f5c851dd293aa0be8273dab3ef2b2ab2944274a6c3add2b5595c3382fde23
MD5 a0386a0322a4b50e155eeb6485628d2a
BLAKE2b-256 49e73bccee23f6f00079729063b458d6077f12d440af9fe399b162c4ab6c1297

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