{"id":5216,"library":"fasta2a","title":"Fasta2a","description":"Fasta2a (current version 0.6.0) is a Python library that converts an AI Agent into an A2A (Agent-to-Agent) server. It facilitates communication between AI agents by implementing the A2A protocol, allowing agents to expose their capabilities and interact programmatically. The library is relatively new but actively developed, with releases occurring every few months as the protocol specification evolves.","status":"active","version":"0.6.0","language":"en","source_language":"en","source_url":"https://github.com/pydantic/fasta2a","tags":["AI agents","A2A","server","protocol","FastAPI"],"install":[{"cmd":"pip install fasta2a","lang":"bash","label":"Install fasta2a"}],"dependencies":[{"reason":"Core web framework for the ASGI application.","package":"fastapi","optional":false},{"reason":"ASGI server for running the application.","package":"uvicorn","optional":false},{"reason":"Data validation and settings management.","package":"pydantic","optional":false},{"reason":"Settings management for FastAPI applications.","package":"pydantic-settings","optional":false},{"reason":"Asynchronous I/O primitives.","package":"anyio","optional":false}],"imports":[{"symbol":"Fasta2aApp","correct":"from fasta2a.app import Fasta2aApp"},{"symbol":"AgentMessage","correct":"from fasta2a.schema import AgentMessage"},{"symbol":"AgentResponse","correct":"from fasta2a.schema import AgentResponse"},{"symbol":"ToolCall","correct":"from fasta2a.schema import ToolCall"},{"symbol":"StreamMessageResponse","correct":"from fasta2a.schema import StreamMessageResponse"}],"quickstart":{"code":"import uvicorn\nfrom fasta2a.app import Fasta2aApp\nfrom fasta2a.schema import AgentMessage, AgentResponse, ToolCall\n\napp = Fasta2aApp()\n\n@app.handle_message()\nasync def my_agent_handler(message: AgentMessage) -> AgentResponse:\n    \"\"\"Handles incoming AgentMessage and returns an AgentResponse.\"\"\"\n    print(f\"Received message: {message.body}\")\n    if message.body == \"hello\":\n        return AgentResponse(body=\"world\")\n    elif message.body == \"call_tool\":\n        return AgentResponse(\n            body=\"I am calling a hypothetical tool!\",\n            toolCalls=[\n                ToolCall(\n                    name=\"my_example_tool\",\n                    arguments={\"param1\": \"value1\", \"param2\": 123}\n                )\n            ]\n        )\n    return AgentResponse(body=f\"Unknown message: {message.body}\")\n\n# To run this application, save it as, e.g., `main.py`\n# and execute from your terminal:\n# uvicorn main:app --host 0.0.0.0 --port 8000\n# Then you can interact with it using an A2A client.","lang":"python","description":"This quickstart demonstrates how to create a basic Fasta2a application by initializing `Fasta2aApp` and defining an asynchronous message handler using the `@app.handle_message()` decorator. The handler processes `AgentMessage` objects and returns `AgentResponse` objects, optionally including `ToolCall`s. The example also shows how to run the application using `uvicorn`."},"warnings":[{"fix":"Always check the release notes for the supported A2A protocol version for your `fasta2a` library version. Upgrade `fasta2a` to match the desired protocol version, or ensure your client/agent adheres to the protocol version supported by your `fasta2a` server.","message":"The A2A protocol version support changes between `fasta2a` releases. For example, `v0.6.0` introduced support for `protocolVersion 0.3.0`. Older versions of `fasta2a` may not be compatible with newer protocol versions, and vice-versa, leading to parsing errors or unexpected agent behavior.","severity":"breaking","affected_versions":"<0.6.0"},{"fix":"Regularly review the `fasta2a` changelog and schema definitions when upgrading. Be prepared to adapt your agent logic and data models to new schema versions to maintain compatibility.","message":"The core A2A schemas (`AgentMessage`, `AgentResponse`, `ToolCall`, `StreamMessageResponse`, etc.) are actively evolving as the protocol matures. Code relying on specific schema fields or structures might require updates with new `fasta2a` releases.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To run your `fasta2a` application, use the command `uvicorn your_module_name:app --host 0.0.0.0 --port 8000` (replacing `your_module_name` with your script's filename). Do not attempt to run it directly as `python your_module_name.py`.","message":"Fasta2a applications are ASGI applications and must be run with a compatible ASGI server (e.g., `uvicorn`) to be accessible. Simply running the Python script will define the application object but will not serve it over HTTP.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}