a2a_platform#
- class baf.platforms.a2a.a2a_platform.A2APlatform(agent, version='1.0', capabilities=None, id=None, endpoints=None, descriptions=None, skills=None, examples=None, methods=None, provider='BESSER-Agentic-Framework')[source]#
Bases:
PlatformA2APlatform implements the Agent-to-Agent (A2A) communication platform for agent interactions. This platform enables agents to communicate with each other using a RESTful API and Server-Sent Events (SSE) over HTTP. It stores agent metadata (e.g., capabilities and examples), registers methods, maintains task creation, execution and status tracking, supports tracked and untracked agent-to-agent calls, provides synchronous and asynchronous operations, and supports agent orchestration for coordinating multiple agents.
- Parameters:
agent (Agent) – The agent instance this platform belongs to
version (str, optional) – Version of the agent. Defaults to ‘1.0’
capabilities (list[str], optional) – List of agent capabilities. Defaults to []
id (str, optional) – Unique identifier for the agent. Defaults to UUID4
endpoints (list[str], optional) – List of API endpoints. Defaults to standard endpoints at localhost:8000
descriptions (list[str], optional) – List of agent descriptions. Defaults to []
skills (list[str], optional) – List of agent skills. Defaults to []
examples (Union[list[dict], list[str]], optional) – Usage examples. Defaults to []
methods (list[dict], optional) – List of available methods. Defaults to []
provider (str, optional) – Provider name. Defaults to “BESSER-Agentic-Framework”
- agent_card#
Contains metadata about the agent’s capabilities, interface, connection and so on
- Type:
- _app#
Web application to run this platform
- Type:
web.Application
- _abc_impl = <_abc._abc_data object>#
- add_descriptions(descriptions)[source]#
Helper function to add agent’s description to the agent_card
- async create_and_execute_task(method, params)[source]#
This is an internal method. It creates a task and runs it in the background (asynchronous).
- populate_methods_from_router()[source]#
Automatically fetch agent’s registered methods from router and add it to the agent_card.
- register_orchestration_as_task(name, coroutine_func, registry)[source]#
Wrap an async orchestration function as a tracked task. Tracking can be done in the orchestration agent_id/tasks endpoint. Backward compatible with coroutine_func.
- register_orchestration_task_on_resp_agent(name, func, registry)[source]#
This function is only for async execution of multiple agents, does not register the execution as a task in Orchestrator’s task endpoint. Will register tasks on the respective agent’s router. So tasks can be tracked only in their respective agent_id/tasks.
- async rpc_call_agent(target_agent_id, method, params, registry)[source]#
Calls another agent as a subtask, waits for it to complete, and returns its task info, results and so on. Orchestration task cannot track subtask statuses. They can be tracked in the respective agent_id/tasks endpoint.
- async rpc_call_agent_tracked(target_agent_id, method, params, registry, parent_task=None)[source]#
Calls another agent as a subtask, waits for it to complete, and returns its task info, results and so on. Ensures the orchestration task can track subtask statuses at orchestrator agent_id/tasks endpoint.