> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-codex-docs-audit-20260719-0149.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# YAML Config

> Load AgentOS configuration from a YAML file and attach Slack and WhatsApp interfaces.

```python yaml_config.py theme={null}
"""
Yaml Config
===========

Demonstrates yaml config.
"""

from pathlib import Path

from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.models.openai import OpenAIChat
from agno.os import AgentOS
from agno.os.interfaces.slack import Slack
from agno.os.interfaces.whatsapp import Whatsapp
from agno.team import Team
from agno.workflow.step import Step
from agno.workflow.workflow import Workflow

# ---------------------------------------------------------------------------
# Create Example
# ---------------------------------------------------------------------------

cwd = Path(__file__).parent
os_config_path = str(cwd.joinpath("config.yaml"))

# Setup the database
db = PostgresDb(db_url="postgresql+psycopg://ai:ai@localhost:5532/ai", id="db-0001")

# Setup basic agents, teams and workflows
basic_agent = Agent(
    id="basic-agent",
    name="Basic Agent",
    db=db,
    enable_session_summaries=True,
    update_memory_on_run=True,
    add_history_to_context=True,
    num_history_runs=3,
    add_datetime_to_context=True,
    markdown=True,
)
basic_team = Team(
    id="basic-team",
    name="Basic Team",
    model=OpenAIChat(id="gpt-4o"),
    db=db,
    members=[basic_agent],
    update_memory_on_run=True,
)
basic_workflow = Workflow(
    id="basic-workflow",
    name="Basic Workflow",
    description="Just a simple workflow",
    db=db,
    steps=[
        Step(
            name="step1",
            description="Just a simple step",
            agent=basic_agent,
        )
    ],
)

# Setup our AgentOS app
agent_os = AgentOS(
    description="Example AgentOS",
    id="basic-os",
    agents=[basic_agent],
    teams=[basic_team],
    workflows=[basic_workflow],
    interfaces=[Whatsapp(agent=basic_agent), Slack(agent=basic_agent)],
    # Configuration for the AgentOS
    config=os_config_path,
)
app = agent_os.get_app()


# ---------------------------------------------------------------------------
# Run Example
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    """Run your AgentOS.

    You can see the configuration and available endpoints at:
    http://localhost:7777/config
    """
    agent_os.serve(app="yaml_config:app", reload=True)
```

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U "agno[os,slack]" "psycopg[binary]" openai
    ```
  </Step>

  <Step title="Export environment variables">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export OPENAI_API_KEY="your_openai_api_key_here"
      export SLACK_SIGNING_SECRET="your_slack_signing_secret_here"
      export SLACK_TOKEN="your_slack_token_here"
      export WHATSAPP_ACCESS_TOKEN="your_whatsapp_access_token_here"
      export WHATSAPP_APP_SECRET="your_whatsapp_app_secret_here"
      export WHATSAPP_PHONE_NUMBER_ID="your_whatsapp_phone_number_id_here"
      export WHATSAPP_VERIFY_TOKEN="your_whatsapp_verify_token_here"
      ```

      ```bash Windows theme={null}
      $Env:OPENAI_API_KEY="your_openai_api_key_here"
      $Env:SLACK_SIGNING_SECRET="your_slack_signing_secret_here"
      $Env:SLACK_TOKEN="your_slack_token_here"
      $Env:WHATSAPP_ACCESS_TOKEN="your_whatsapp_access_token_here"
      $Env:WHATSAPP_APP_SECRET="your_whatsapp_app_secret_here"
      $Env:WHATSAPP_PHONE_NUMBER_ID="your_whatsapp_phone_number_id_here"
      $Env:WHATSAPP_VERIFY_TOKEN="your_whatsapp_verify_token_here"
      ```
    </CodeGroup>
  </Step>

  <Snippet file="run-pgvector-step.mdx" />

  <Step title="Clone Agno">
    Clone the repository and run the remaining commands from its root:

    ```bash theme={null}
    git clone --branch v2.7.4 --depth 1 https://github.com/agno-agi/agno.git
    cd agno
    ```
  </Step>

  <Step title="Run the example">
    Run the example from the repository root:

    ```bash theme={null}
    python cookbook/05_agent_os/os_config/yaml_config.py
    ```
  </Step>
</Steps>

Full source: [cookbook/05\_agent\_os/os\_config/yaml\_config.py](https://github.com/agno-agi/agno/blob/v2.7.4/cookbook/05_agent_os/os_config/yaml_config.py)
