> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Product Copilots & Agents

> Embed agents in your product with REST endpoints, persistent user state, knowledge, and interfaces.

Product engineering teams embed agents so customers can ask questions, work with their data, and take action inside the application. AgentOS gives these teams 80+ REST endpoints for running agents and managing sessions, memory, knowledge, traces, evaluations, and approvals. The same backend can power chat, inline actions, background jobs, and messaging interfaces while keeping user state in one database.

```python copilot.py theme={null}
from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.models.openai import OpenAIResponses
from agno.os import AgentOS

db = PostgresDb(db_url="postgresql+psycopg://ai:ai@localhost:5532/ai")

agent = Agent(
    name="Product Copilot",
    model=OpenAIResponses(id="gpt-5.5"),
    db=db,
    add_history_to_context=True,
    num_history_runs=5,
    enable_agentic_memory=True,
)

agent_os = AgentOS(agents=[agent], db=db)
app = agent_os.get_app()

if __name__ == "__main__":
    agent_os.serve(app="copilot:app", port=7777)
```

This configuration provides an HTTP API, persistent multi-turn history, and per-user memory. Authentication is disabled until you enable it. See [Serve as an API](/use-cases/product-agents/serve-as-an-api#auth) for JWT authorization and opt-in per-user isolation.

## How product surfaces connect

The agent runs in your AgentOS as a service. Every product surface is a client that calls it over HTTP.

| Surface                                           | How it reaches the agent                                                    |
| ------------------------------------------------- | --------------------------------------------------------------------------- |
| In-app copilot panel                              | `POST /agents/{agent_id}/runs` with `user_id` and a per-thread `session_id` |
| Inline action ("summarize this", "draft a reply") | The same endpoint, a short-lived `session_id`                               |
| Slack / Telegram / WhatsApp                       | An interface adapter maps the channel onto runs and sessions                |
| Backend event (webhook, cron)                     | A custom FastAPI route calling `agent.arun(...)`                            |

Stored memory can follow a user when surfaces call the same agent with the same `user_id` and database. Session history continues only when they also reuse the same `session_id`. Messaging interfaces usually create surface-specific session IDs.

## Choose a path

| You have                                        | You want                                         | Start with                                                             |
| ----------------------------------------------- | ------------------------------------------------ | ---------------------------------------------------------------------- |
| A B2B SaaS product                              | JWT authentication and opt-in per-user isolation | [Serve as an API](/use-cases/product-agents/serve-as-an-api)           |
| Users in Slack or the browser                   | The same agent where they already work           | [Interfaces](/use-cases/product-agents/interfaces)                     |
| An indexed document corpus                      | Answers grounded in retrieved content            | [Knowledge agents](/use-cases/knowledge-agents)                        |
| Live systems such as Slack, Drive, or databases | Current records queried at run time              | [Connecting your data](/use-cases/product-agents/connecting-your-data) |
| Multi-day user relationships                    | Memory that persists per user across surfaces    | [Sessions and memory](/use-cases/product-agents/sessions-and-memory)   |

## Explore

<CardGroup cols={2}>
  <Card title="Serve as an API" icon="server" href="/use-cases/product-agents/serve-as-an-api">
    Turn the agent into an HTTP service with streaming, sessions, and auth.
  </Card>

  <Card title="Sessions and memory" icon="clock-rotate-left" href="/use-cases/product-agents/sessions-and-memory">
    Store multi-turn history and per-user memory in the configured database.
  </Card>

  <Card title="Connecting your data" icon="plug" href="/use-cases/product-agents/connecting-your-data">
    Give the agent access to Slack, Drive, databases, and MCP servers.
  </Card>

  <Card title="Interfaces" icon="comments" href="/use-cases/product-agents/interfaces">
    Connect Slack, Telegram, WhatsApp, and browser clients through interface adapters.
  </Card>
</CardGroup>

## Developer Resources

* [Runtime overview](/features/runtime)
* [Sessions](/sessions/overview)
* [Memory](/memory/overview)
* [Scout template](/deploy/templates/scout/overview)
