Files
Giles Odigwe 0d09d40f0f Python: Fix GitHubCopilotAgent to include tools added by ContextProvider.before_run in session creation (#5780)
* Fix GitHubCopilotAgent ignoring tools from context providers (#5736)

_create_session and _resume_session only forwarded self._tools (constructor
tools) to CopilotClient.create_session, dropping any tools contributed by
context providers via session_context.extend_tools() during before_run.

Merge provider-contributed tools into runtime_options in both _run_impl and
_stream_updates before session creation, mirroring how RawAgent handles the
merge at lines 1435-1440 in _agents.py. Update _create_session and
_resume_session to combine self._tools with the merged runtime tools.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Python: Fix GitHubCopilotAgent to include tools added by ContextProvider.before_run in session creation

Fixes #5736

* Fix provider tool merge to avoid mutating caller's list

- Replace in-place .extend() with fresh list creation in both
  _run_impl and _stream_updates paths to prevent mutating the
  caller-provided options['tools'] list (shallow copy issue)
- Also handles immutable Sequence types (e.g. tuple) correctly
- Add test for provider tools forwarded via _resume_session path

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review feedback for #5736: review comment fixes

---------

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0d09d40f0f ยท 2026-05-15 14:59:22 +00:00
History
..

Get Started with Microsoft Agent Framework A2A

Please install this package via pip:

pip install agent-framework-a2a --pre

A2A Agent Integration

The A2A agent integration enables communication with remote A2A-compliant agents using the standardized A2A protocol. This allows your Agent Framework applications to connect to agents running on different platforms, languages, or services.

A2AAgent (Client)

The A2AAgent class is a client that wraps an A2A Client to connect the Agent Framework with external A2A-compliant agents.

from agent_framework.a2a import A2AAgent

# Connect to a remote A2A agent
a2a_agent = A2AAgent(url="http://remote-agent/a2a")
response = await a2a_agent.run("Hello!")

A2AExecutor (Hosting)

The A2AExecutor class bridges local AI agents built with the agent_framework library to the A2A protocol, allowing them to be hosted and accessed by other A2A-compliant clients.

from agent_framework.a2a import A2AExecutor
from a2a.server.apps import A2AStarletteApplication
from a2a.server.request_handlers import DefaultRequestHandler
from a2a.server.tasks import InMemoryTaskStore

# Create an A2A executor for your agent
executor = A2AExecutor(agent=my_agent)

# Set up the request handler and server application
request_handler = DefaultRequestHandler(
    agent_executor=executor,
    task_store=InMemoryTaskStore(),
)

app = A2AStarletteApplication(
    agent_card=my_agent_card,
    http_handler=request_handler,
).build()

Basic Usage Example

See the A2A agent examples which demonstrate:

  • Connecting to remote A2A agents
  • Hosting local agents via A2A protocol
  • Sending messages and receiving responses
  • Handling different content types (text, files, data)
  • Streaming responses and real-time interaction