Metadata-Version: 2.4
Name: agent-framework-hosting-a2a
Version: 1.0.0a260721
Summary: A2A conversion helpers for app-owned Agent Framework hosting.
Author-email: Microsoft <af-support@microsoft.com>
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
License-File: LICENSE
Requires-Dist: a2a-sdk>=1.0.0,<2
Requires-Dist: agent-framework-core>=1.11.0,<2
Requires-Dist: agent-framework-hosting==1.0.0a260721
Project-URL: homepage, https://aka.ms/agent-framework
Project-URL: issues, https://github.com/microsoft/agent-framework/issues
Project-URL: release_notes, https://github.com/microsoft/agent-framework/releases?q=tag%3Apython-1&expanded=true
Project-URL: source, https://github.com/microsoft/agent-framework/tree/main/python

# agent-framework-hosting-a2a

A2A conversion helpers for app-owned Agent Framework hosting.

The package deliberately does not choose a web framework or wrap the A2A SDK
server lifecycle. It provides two conversion functions:

- `a2a_to_run(...)` converts a native A2A `Message` into Agent Framework run
  arguments.
- `a2a_from_run(...)` converts an `AgentResponse`, `Message`, or streaming
  `AgentResponseUpdate` into native A2A `Part` values.

Application code keeps ownership of the A2A SDK's `AgentExecutor`,
`RequestContext`, `TaskUpdater`, event queue, task store, routes, task state,
artifact IDs, authentication, and deployment.

`a2a_from_run(...)` preserves content-level metadata on each returned part and
flattens completed responses in message order. The application decides how to
group those parts into A2A messages or artifacts and owns their message-level
metadata and boundaries.

```python
run = a2a_to_run(context.message)
session_id = f"a2a:{context.tenant}:{context.context_id}"
session = await state.get_or_create_session(session_id)
result = await agent.run(
    run["messages"],
    session=session,
    options=run["options"],
)
await state.set_session(session_id, session)
parts = a2a_from_run(result)

# Native A2A SDK application code publishes `parts` with TaskUpdater.
```

The surrounding A2A application may use Starlette, FastAPI, another ASGI
framework, or the SDK's own application builders. These helpers do not care.

