***

title: Agents
sidebar-title: Overview
subtitle: Python API reference for AgentBase, SWMLService, SWAIG functions, skills, contexts, LiveWire, search, and more
slug: /reference/python/agents
description: Core framework for building AI-powered voice agents.
max-toc-depth: 3
position: 0
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[swml]: /docs/swml/reference/ai

[agent-base]: /docs/server-sdks/reference/python/agents/agent-base

[swml-service]: /docs/server-sdks/reference/python/agents/swml-service

[swml-builder]: /docs/server-sdks/reference/python/agents/swml-builder

[swaig-function]: /docs/server-sdks/reference/python/agents/swaig-function

[function-result]: /docs/server-sdks/reference/python/agents/function-result

[context-builder]: /docs/server-sdks/reference/python/agents/context-builder

[data-map]: /docs/server-sdks/reference/python/agents/data-map

[skill-base]: /docs/server-sdks/reference/python/agents/skill-base

[pom-builder]: /docs/server-sdks/reference/python/agents/pom-builder

[agent-server]: /docs/server-sdks/reference/python/agents/agent-server

[bedrock-agent]: /docs/server-sdks/reference/python/agents/bedrock-agent

[prefabs]: /docs/server-sdks/reference/python/agents/prefabs

[skills]: /docs/server-sdks/reference/python/agents/skills

[cli]: /docs/server-sdks/reference/python/agents/cli

[configuration]: /docs/server-sdks/reference/python/agents/configuration

[livewire]: /docs/server-sdks/reference/python/agents/livewire

[search]: /docs/server-sdks/reference/python/agents/search

[mcp-gateway]: /docs/server-sdks/reference/python/agents/mcp-gateway

[web-service]: /docs/server-sdks/reference/python/agents/web-service

[helpers]: /docs/server-sdks/reference/python/agents/helpers

[ref-agentbase]: /docs/server-sdks/reference/python/agents/agent-base

The Agents namespace provides the core framework for building AI-powered voice
agents with SignalWire. It includes the central [`AgentBase`][ref-agentbase] class, SWML document
generation, tool/function definitions, skills, multi-agent hosting, CLI tools
for local testing and deployment, and configuration management for security
and environment settings.

<Info>
  The Agents SDK generates [SWML][swml] documents under the hood.
  Each agent produces a SWML document with the `ai` verb that the SignalWire platform executes.
</Info>

## Example

A complete agent that answers calls, uses an AI prompt, and exposes a custom tool:

```python
from signalwire import AgentBase
from signalwire.core.function_result import FunctionResult

agent = AgentBase(name="support-agent", route="/support")
agent.set_prompt_text(
    "You are a friendly support agent for Acme Corp. "
    "Help customers check their order status. "
    "Be concise and professional."
)
agent.set_params({"temperature": 0.5, "end_of_speech_timeout": 800})

@agent.tool(description="Look up an order by ID")
def check_order(args, raw_data):
    order_id = args.get("order_id", "unknown")
    return FunctionResult(f"Order {order_id} shipped on March 28 and arrives tomorrow.")

agent.add_skill("datetime")

if __name__ == "__main__":
    agent.serve()
```

## Classes

<CardGroup cols={2}>
  <Card title="AgentBase" href="/docs/server-sdks/reference/python/agents/agent-base">
    The central class for building AI agents. Manages prompts, tools, skills, and serving.
  </Card>

  <Card title="SWMLService" href="/docs/server-sdks/reference/python/agents/swml-service">
    SWML document generation and FastAPI service base class.
  </Card>

  <Card title="SWMLBuilder" href="/docs/server-sdks/reference/python/agents/swml-builder">
    Fluent builder for constructing SWML documents programmatically.
  </Card>

  <Card title="SWAIGFunction" href="/docs/server-sdks/reference/python/agents/swaig-function">
    Wraps Python functions as callable SWAIG tools with validation and metadata.
  </Card>

  <Card title="FunctionResult" href="/docs/server-sdks/reference/python/agents/function-result">
    Fluent interface for returning actions and responses from tool functions.
  </Card>

  <Card title="ContextBuilder" href="/docs/server-sdks/reference/python/agents/context-builder">
    Multi-step agent workflows with context and step navigation.
  </Card>

  <Card title="DataMap" href="/docs/server-sdks/reference/python/agents/data-map">
    Server-side API tools that execute REST calls without agent webhooks.
  </Card>

  <Card title="SkillBase" href="/docs/server-sdks/reference/python/agents/skill-base">
    Base class for building reusable skill plugins.
  </Card>

  <Card title="PomBuilder" href="/docs/server-sdks/reference/python/agents/pom-builder">
    Prompt Object Model builder for structured prompt composition.
  </Card>

  <Card title="AgentServer" href="/docs/server-sdks/reference/python/agents/agent-server">
    Host multiple agents on a single FastAPI process with route-based dispatch.
  </Card>

  <Card title="BedrockAgent" href="/docs/server-sdks/reference/python/agents/bedrock-agent">
    Amazon Bedrock voice-to-voice agent extending AgentBase.
  </Card>

  <Card title="Prefabs" href="/docs/server-sdks/reference/python/agents/prefabs">
    Pre-built agent templates for common conversational patterns.
  </Card>

  <Card title="Skills" href="/docs/server-sdks/reference/python/agents/skills">
    Built-in skills catalog with 17 pluggable capabilities.
  </Card>

  <Card title="CLI Tools" href="/docs/server-sdks/reference/python/agents/cli">
    Command-line tools for testing, searching, scaffolding, and deployment.
  </Card>

  <Card title="Configuration" href="/docs/server-sdks/reference/python/agents/configuration">
    Environment variables, config files, security settings, and authentication.
  </Card>

  <Card title="LiveWire" href="/docs/server-sdks/reference/python/agents/livewire">
    LiveKit-compatible API layer — use familiar livekit-agents classes on SignalWire infrastructure.
  </Card>

  <Card title="Search" href="/docs/server-sdks/reference/python/agents/search">
    Vector search engine for building knowledge bases with document processing and indexing.
  </Card>

  <Card title="MCP Gateway" href="/docs/server-sdks/reference/python/agents/mcp-gateway">
    Model Context Protocol bridge connecting MCP servers to SWAIG functions.
  </Card>

  <Card title="WebService" href="/docs/server-sdks/reference/python/agents/web-service">
    Static file serving with security, CORS, and SSL support.
  </Card>

  <Card title="Helper Functions" href="/docs/server-sdks/reference/python/agents/helpers">
    Convenience functions for creating contexts, API tools, and managing skills.
  </Card>
</CardGroup>