Skip to content

Runtime module

serve async

serve(agent: Agent) -> None

Serve an agent as a Redpanda Connect processor plugin.

This method runs for the entire lifetime of the server.

Parameters:

Name Type Description Default
agent Agent

The agent to serve.

required
Source code in src/redpanda/runtime/__init__.py
async def serve(agent: Agent) -> None:
    """
    Serve an agent as a Redpanda Connect processor plugin.

    This method runs for the entire lifetime of the server.

    Args:
        agent: The agent to serve.
    """
    provider = tracesdk.TracerProvider()
    trace.set_tracer_provider(provider)
    provider.add_span_processor(SimpleSpanProcessor(PassthroughTraceCollector()))
    addr = os.getenv("REDPANDA_CONNECT_AGENT_RUNTIME_MCP_SERVER")
    if addr:
        agent.mcp.append(_TracingSSEMCPEndpoint(addr))
    server = RuntimeServer(agent, trace.get_tracer("redpanda.runtime"))
    await serve_main(server)