The Serve module enables developers to expose components built with the BeeAI Framework through a server to external clients. Out of the box, we provide implementations for protocols such as A2A and MCP, allowing you to quickly serve existing functionalities. You can also create your own custom adapter if needed.
Location within the framework: beeai_framework/serve.

Supported Providers

The following table lists the currently supported providers:
NameDependencyLocation
A2Abeeai_framework.adapters.a2a.servebeeai-platform[a2a]
BeeAI Platformbeeai_framework.adapters.beeai_platform.servebeeai-platform[beeai-platform]
MCPbeeai_framework.adapters.mcp.servebeeai-platform[mcp]
For more details, see the Integrations page.

Usage

from beeai_framework.adapters.a2a import A2AServer, A2AServerConfig
from beeai_framework.agents.experimental import RequirementAgent
from beeai_framework.backend import ChatModel
from beeai_framework.memory import UnconstrainedMemory
from beeai_framework.serve.utils import LRUMemoryManager
from beeai_framework.tools.search.duckduckgo import DuckDuckGoSearchTool
from beeai_framework.tools.weather import OpenMeteoTool


def main() -> None:
    llm = ChatModel.from_name("ollama:granite3.3:8b")
    agent = RequirementAgent(
        llm=llm,
        tools=[DuckDuckGoSearchTool(), OpenMeteoTool()],
        memory=UnconstrainedMemory(),
    )

    # Register the agent with the A2A server and run the HTTP server
    # For the ToolCallingAgent, we don't need to specify ACPAgent factory method
    # because it is already registered in the A2AServer
    # we use LRU memory manager to keep limited amount of sessions in the memory
    A2AServer(config=A2AServerConfig(port=9999), memory_manager=LRUMemoryManager(maxsize=100)).register(agent).serve()


if __name__ == "__main__":
    main()

Extending Functionality

By default, each provider supports registration of a limited set of modules (agents, tools, templates, etc.). You can extend this functionality by registering a custom factory using Server.register_factory method.