Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/packages/core/agent_framework/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@
"USER_AGENT_TELEMETRY_DISABLED_ENV_VAR",
"Agent",
"AgentContext",
"AgentFrameworkException",
"AgentEvalConverter",
"AgentExecutor",
"AgentExecutorRequest",
"AgentExecutorResponse",
"AgentFrameworkException",
"AgentMiddleware",
"AgentMiddlewareLayer",
"AgentMiddlewareTypes",
Expand Down
2 changes: 0 additions & 2 deletions python/packages/core/tests/core/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

"""Tests for AgentFrameworkException inner_exception handling."""

import pytest

from agent_framework import AgentFrameworkException


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ async def poem_workflow(topic: str) -> str:
poem = (await writer.run(f"Write a poem about: {topic}")).text
review = (await reviewer.run(f"Review this poem: {poem}")).text
return f"Poem:\n{poem}\n\nReview: {review}"


# </create_workflow>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ async def text_workflow(text: str) -> str:
"""Uppercase the text, then reverse it."""
upper = await to_upper_case(text)
return await reverse_text(upper)


# </create_workflow>


Expand Down
8 changes: 8 additions & 0 deletions python/samples/04-hosting/a2a/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Azure AI Foundry Configuration (required for a2a_server.py and a2a_agent_as_function_tools.py)
FOUNDRY_PROJECT_ENDPOINT=https://your-project.services.ai.azure.com/api/projects/your-project
FOUNDRY_MODEL=gpt-4o

# A2A Client Configuration (required for agent_with_a2a.py and a2a_agent_as_function_tools.py)
# The function-tools flow uses http://localhost:5000/ in the sample docs/output.
# Update this value if you start a different local A2A server instance on another port.
A2A_AGENT_HOST=http://localhost:5000/
25 changes: 25 additions & 0 deletions python/samples/04-hosting/a2a/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,33 @@ All commands below should be run from this directory:
cd python/samples/04-hosting/a2a
```

### 0. Install Dependencies

Copy `.env.example` to `.env` and fill in your values:

```powershell
copy .env.example .env
```

**Option A — pip (standard):**

```powershell
python -m venv .venv
.venv\Scripts\Activate.ps1 # Windows
# source .venv/bin/activate # macOS / Linux
pip install -r requirements.txt
```
Comment thread
moonbox3 marked this conversation as resolved.

**Option B — uv:**

```powershell
uv run python a2a_server.py --agent-type policy
```

### 1. Start the A2A Server

> **Note (Option A — pip users):** Replace `uv run python` with `python` in all `uv run` commands below (e.g. `python a2a_server.py ...`). `uv` is not required once the virtual environment is activated.

Pick an agent type and start the server (each in its own terminal):

```powershell
Expand Down
2 changes: 1 addition & 1 deletion python/samples/04-hosting/a2a/agent_framework_to_a2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
agent = Agent(
client=OpenAIChatClient(),
name="Europe Travel Agent",
instructions="You are a helpful Europe Travel Agent. You can help users search and book flights and hotels across Europe."
instructions="You are a helpful Europe Travel Agent. You can help users search and book flights and hotels across Europe.",
)

request_handler = DefaultRequestHandler(
Expand Down
23 changes: 23 additions & 0 deletions python/samples/04-hosting/a2a/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Agent Framework packages
# To use the deployed version, uncomment the lines below and comment out the local installation lines
# agent-framework-a2a
# agent-framework-foundry

# Local installation (for development and testing)
# Each package must be listed explicitly because pip doesn't resolve uv workspace sources.
# Without explicit entries, pip would fetch transitive dependencies from PyPI instead of local source.
-e ../../../packages/core # Core framework - base dependency for all packages
-e ../../../packages/foundry # Foundry support - dependency for FoundryChatClient in a2a_server.py
-e ../../../packages/a2a # A2A integration - provides A2AAgent and a2a-sdk

# Azure authentication
azure-identity

# A2A server runtime
uvicorn

# HTTP client used by A2A client samples
httpx

# Environment variable loading
python-dotenv
Loading