Skip to main content

Developer SDK + CLI for building, packaging, and deploying A2A agents.

Project description

a2a-pack

Developer SDK + CLI for building, packaging, and deploying full A2A compliant agents.

One Python class becomes a sandboxed, discoverable, MCP-compatible, full A2A compliant AI agent on the a2a cloud platform. Other agents reach yours via HMAC-signed grants. The platform owns deployment, execution, permissions, and (when you're ready) billing.

a2a-pack makes Google's Agent2Agent protocol easy: Agent Cards, tasks, messages, artifacts, file/data exchange, streaming, auth, JSON-RPC, REST, and protocol errors are handled by the SDK runtime.

pip install a2a-pack
a2a signup --email you@example.com --password ...
a2a init research-agent
cd research-agent
a2a dev
a2a test --invoke
a2a deploy
# -> https://research-agent.a2acloud.io   (A2A, MCP, TLS, all wired)

What an agent looks like

from pydantic import BaseModel
from a2a_pack import (
    A2AAgent, LLMProvisioning, NoAuth, Pricing, RunContext, skill,
)


class GreeterConfig(BaseModel):
    suffix: str = "!"


class Greeter(A2AAgent[GreeterConfig, NoAuth]):
    name = "greeter"
    description = "Say hi."
    version = "0.1.0"
    config_model = GreeterConfig
    auth_model = NoAuth

    # Use the caller's own LLM key (forwarded by the platform) — the
    # author's price stays small; the LLM bill goes to the caller's
    # provider directly.
    llm_provisioning = LLMProvisioning.CALLER_PROVIDED
    pricing = Pricing(price_per_call_usd=0.01, caller_pays_llm=True)

    @skill(description="Greet someone.")
    async def greet(self, ctx: RunContext[NoAuth], who: str) -> str:
        await ctx.emit_progress(f"greeting {who}")
        return f"hello {who}{self.config.suffix}"

That's it. a2a deploy packages the source, the control plane builds the image, ArgoCD reconciles, you get a full A2A compliant public URL.

Local development

Use the same agent card, invoke path, secret names, and workspace contract before uploading anything:

a2a dev

That starts the agent at http://127.0.0.1:8000, loads .env.local, creates .a2a/workspace/{inputs,outputs}, and enables hot reload. Skills are callable at POST /invoke/{skill} and the card is visible at /.well-known/agent-card.

It also serves a bundled local console at http://127.0.0.1:8000/_dev with drag-and-drop file upload into inputs/, workspace file previews/downloads, schema-derived skill inputs, streaming progress, and final results.

Packed frontends

Agents can ship with a static frontend app mounted by the same runtime:

a2a init chart-agent --frontend static
a2a init chart-agent --frontend react
a2a init private-app --frontend react --auth platform
a2a frontend build
a2a dev

The manifest lives in a2a.yaml:

frontend:
  path: frontend
  build: npm run build   # optional for prebuilt static bundles
  dist: dist
  mount: /app
  auth: inherit

Use --auth platform to scaffold a packed app that requires an A2A Cloud session. The generated agent uses PlatformUserAuth, so skill code can read ctx.auth.user_id, ctx.auth.email, ctx.auth.org_slug, and ctx.auth.scopes without wiring OAuth itself. Hosted deployments verify the HttpOnly platform session cookie against the control plane; trusted identity headers are opt-in for gateway deployments.

At runtime the agent serves the app and generated contract data:

Path Purpose
/app/ Packed frontend app
/app/config.json Agent name, endpoints, auth mode, docs URL, skill schemas
/app/a2a-client.js Browser client for agent.call(...) and agent.skills.<name>(...)
/.well-known/a2a-skills.json Skill names, scopes, input schemas, output schemas
/auth/session Local dev session, or platform-provided user/session metadata

Deploys either copy a prebuilt frontend/dist bundle or run frontend.build inside a Node build stage before the Python A2A runtime starts.

The React scaffold creates a Vite app with a generated skill runner. Start a2a dev in one terminal and npm run dev inside frontend/ in another; Vite proxies /app/config.json, /invoke, /auth, /mcp, and /.well-known to the local agent runtime.

Run preflight checks before deploy:

a2a test
a2a test --invoke --skill summarize --args-json '{"text":"hello"}'

Secrets stay local in .env.local. Workspace-backed framework tools, including DeepAgents via ctx.workspace_backend(), write durable local outputs under .a2a/workspace/outputs so you can inspect what will become downloadable files in A2A Cloud.

If your skill runs code that creates files, use ctx.workspace_shell(...) or ctx.workspace_python(...). Those commands run in the platform sandbox with the caller's workspace mounted, so /workspace/... writes persist directly and changed files elsewhere in the sandbox root filesystem are mirrored under outputs/rootfs-captures/.... Plain in-process subprocess calls inside the agent container are not workspace-mounted or rootfs-captured.

Bring your own auth

Agents can make caller identity explicit by declaring an auth_model and an auth_resolver. The resolver receives the inbound bearer token, validates it against your auth system, and returns the typed principal skills read from ctx.auth.

from a2a_pack import A2AAgent, JWTAuth, OIDCUserInfoAuthResolver, RunContext, skill


class CustomerAgent(A2AAgent):
    name = "customer-agent"
    description = "Uses the caller's app login"
    auth_model = JWTAuth
    auth_resolver = OIDCUserInfoAuthResolver(
        "https://auth.example.com/oauth2/userinfo",
        auth_model=JWTAuth,
    )

    @skill(scopes=["profile:read"])
    async def profile(self, ctx: RunContext[JWTAuth]) -> dict[str, str | None]:
        return {"sub": ctx.auth.sub, "email": ctx.auth.email}

For custom APIs, subclass AuthResolver and call your own /me, /introspect, or session-exchange endpoint. SAML-backed apps use the same contract by exposing a bearer-token bridge endpoint that returns JSON.

Public surface

Concept Where
A2AAgent base class + @skill decorator a2a_pack.agent
RunContext, ctx.llm, ctx.ask, ctx.request_scope a2a_pack.context
Grant mint/verify (HMAC, audience-bound, glob-filtered, time-limited) a2a_pack.grants
Workspace negotiation surface a2a_pack.workspace
Sandbox client (microVM via libkrun) a2a_pack.sandbox
Agent-to-agent client (HTTP, in-memory, custom) a2a_pack.a2a_client
MCP server (skills → tools, mountable into your FastAPI app) a2a_pack.mcp
Lifecycle / Resources / Pricing / LLMProvisioning declarations a2a_pack.runtime
Card schema (auto-derived from your class) a2a_pack.card

A2A made easy

  • Subclass A2AAgent.
  • Decorate async methods with @skill.
  • Use RunContext for progress, auth/input requests, artifacts, scoped files, sandbox execution, and agent-to-agent calls.
  • Run a2a deploy; the runtime exposes full A2A plus MCP and HTTPS.

Full reference + auto-generated docs at https://docs.a2acloud.io.

Self-hosting

The platform pieces (control plane, sandbox runtime, gitea, ArgoCD, MinIO, LiteLLM) live at gitea.a2acloud.io — the SDK is the only piece you need on PyPI. If you want to run the whole stack locally or in your own cluster, the bootstrap recipe is in the platform README.

License

MIT — see LICENSE.

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

a2a_pack-0.1.28.tar.gz (154.7 kB view details)

Uploaded Source

Built Distribution

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

a2a_pack-0.1.28-py3-none-any.whl (248.2 kB view details)

Uploaded Python 3

File details

Details for the file a2a_pack-0.1.28.tar.gz.

File metadata

  • Download URL: a2a_pack-0.1.28.tar.gz
  • Upload date:
  • Size: 154.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for a2a_pack-0.1.28.tar.gz
Algorithm Hash digest
SHA256 a94de92ef37c4fc72a87f75983aed69a62545c16416aa56b5ef8a368dc1379f1
MD5 054865f0ef7b52f066d8eeec8bdfc864
BLAKE2b-256 26e75c8f846d0d0c90a95752c84d03f7e63af1b55a3dae5f9dfcad4acd05355f

See more details on using hashes here.

File details

Details for the file a2a_pack-0.1.28-py3-none-any.whl.

File metadata

  • Download URL: a2a_pack-0.1.28-py3-none-any.whl
  • Upload date:
  • Size: 248.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for a2a_pack-0.1.28-py3-none-any.whl
Algorithm Hash digest
SHA256 b259545ad7f279034026cb54d5b48b337bc8f3a4029d25c94d2be4239655ee7b
MD5 1f508877c1612aa68f8dcdc85c4bd355
BLAKE2b-256 e510778ee9b06add7d22eef43f81c91d23bcb424069a65499401632eccb48cc9

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