Skip to main content

agents.demo.demo_agent

Demo Agent for testing the agent-runtimes server.

This script registers a demo agent with the ACP server for testing the WebSocket communication and chat functionality.

Usage: # First, start the server in one terminal: python -m agent_runtimes --reload

# Then, in another terminal, register the demo agent:
python -m agent_runtimes.examples.demo.demo_agent

DemoAgent Objects

class DemoAgent(BaseAgent)

A simple demo agent for testing purposes.

This agent echoes back messages and demonstrates streaming responses.

name

@property
def name() -> str

Get the agent's name.

run

async def run(prompt: str, context: AgentContext) -> AgentResponse

Run the agent on the given context.

stream

async def stream(prompt: str,
context: AgentContext) -> AsyncGenerator[StreamEvent, None]

Stream responses from the agent.

Yields

StreamEvent Stream events containing text deltas and completion signals.

get_tools

def get_tools() -> list[ToolDefinition]

Get the tools available to this agent.

create_demo_agent

def create_demo_agent() -> tuple[DemoAgent, AgentInfo]

Create a demo agent with its info for registration.

create_pydantic_demo_agent

def create_pydantic_demo_agent() -> tuple[Any, AgentInfo]

Create a Pydantic AI demo agent for AG-UI and Vercel AI protocols.

Returns:

Tuple of (PydanticAIAgent, AgentInfo)

main

def main() -> None

Register the demo agent with the server.