Skip to content

Examples

These examples demonstrate how to create and use agents through YAML configuration files.

Simple Text Agent

Create a simple agent that opens websites in your browser:

agents.yml

Use the agent via an ACP client of your choice.

Or programmatically:

from agentpool import AgentPool

async with AgentPool("agents.yml") as pool:
    agent = pool.get_agent("url_opener")
    result = await agent.run("Open the Python website")
    print(result.data)

Structured Responses

Define structured outputs for consistent response formats:

agents.yml

Tool Usage

Create an agent that interacts with the file system:

agents.yml

Use the file manager:

from agentpool import Agent

async with AgentPool("agents.yml" as pool:
    agent = pool.get_agent("file_manager")
    # List files
    result = await agent.run("What files are in the current directory?")
    print(result.data)

    # Read a file
    result = await agent.run("Show me the contents of config.py")
    print(result.data)