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

# KB prompts vs. agents

> Decide whether behavior belongs in knowledge-base prompts, a saved agent, or both.

Knowledge-base prompts and agents solve different problems. A **KB prompt** defines shared answering behavior for a knowledge base. An **agent** packages a repeatable job, model, tools, skills, delegates, and optional schedule on top of one knowledge base.

## The fast decision

| You need to…                                                                      | Use                                |
| --------------------------------------------------------------------------------- | ---------------------------------- |
| Give every chat on a KB the same voice, boundaries, or formatting                 | KB Persona + Instructions          |
| Fully replace Quick or Deep answering behavior                                    | A mode-specific full Custom Prompt |
| Save a repeatable goal with a fixed model and capabilities                        | Agent                              |
| Use connected apps, custom tools, MCP servers, skills, or delegation consistently | Agent                              |
| Run work through the API or on a schedule and inspect run history                 | Agent                              |
| Give several specialized agents one shared answering policy and corpus            | KB prompts + agents                |

<Tip>
  Start with **Persona + Instructions** on the knowledge base. Create an agent when you need repeatable execution, capabilities, versioned deploys, or run history.
</Tip>

## What belongs in KB prompts

Use KB prompts for rules that should follow the knowledge base everywhere:

* **Persona** — who the assistant is and how it presents itself.
* **Instructions** — shared rules, boundaries, citation style, and answer format.
* **Quick Custom Prompt** — a complete replacement for Quick-mode answering behavior.
* **Main/Deep Custom Prompt** — a complete replacement for Deep-mode answering behavior.
* **SQL and chart instructions** — shared behavior for connected data.

<Warning>
  A full Custom Prompt takes over for its mode and supersedes Persona and Instructions. Prefer Persona + Instructions unless you need complete white-label control, and put the whole answering contract inside a full Custom Prompt.
</Warning>

## What belongs in an agent

Use an agent for a named job such as “triage support tickets” or “prepare a weekly account brief.” The agent owns:

* Goal and job-specific instructions
* Model and knowledge base selection
* Web search and durable-memory toggles
* Connected apps, custom tools, MCP servers, and skills
* Callable agents for delegation
* Schedule, versions, runs, and run history

The knowledge base is fixed when the agent is created. Each configuration deploy creates a numbered version; name and status edits do not.

## The common pattern: use both

```text theme={null}
Knowledge base
  Shared Persona + Instructions
  Private documents and connected data
    ├── Support agent     Goal: resolve customer questions
    ├── QA agent          Goal: find documentation gaps
    └── Weekly brief      Goal: summarize trends on a schedule
```

The KB supplies the shared corpus and answering contract. Each agent adds a focused goal and only the capabilities required for its job.

## Configure it in the dashboard

<Steps>
  <Step title="Set the shared KB behavior">
    Open the knowledge base and set Persona and Instructions. Test them in a normal chat first.
  </Step>

  <Step title="Create the specialized agent">
    Choose the same knowledge base, then add a specific goal, job instructions, model, and capabilities.
  </Step>

  <Step title="Run before scheduling">
    Test the agent interactively, inspect its run and sources, then enable a schedule only when the result is dependable.
  </Step>
</Steps>

## Build it with the API

Update shared KB behavior:

```bash theme={null}
curl -X PATCH "$AUTOSAGE_URL/knowledge-bases/KB_ID" \
  -H "Authorization: Bearer $AUTOSAGE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "persona": "You are Acme Support.",
    "instructions": "Answer from approved sources, cite them, and say when the KB does not contain the answer."
  }'
```

Then create a focused agent on that KB:

```bash theme={null}
curl -X POST "$AUTOSAGE_URL/agents" \
  -H "Authorization: Bearer $AUTOSAGE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tenant_id": "TENANT_ID",
    "name": "Support specialist",
    "goal": "Resolve customer support questions.",
    "instructions": "Ask one clarifying question when account context is missing.",
    "model_id": "MODEL_ID",
    "selected_knowledge_base_id": "KB_ID"
  }'
```

## Continue the learning path

<CardGroup cols={2}>
  <Card title="Chat vs. agent runs" icon="arrows-left-right" href="/guides/chat-vs-agent-runs">
    Understand what happens when the new agent executes.
  </Card>

  <Card title="Agent in two minutes" icon="stopwatch" href="/guides/agent-in-two-minutes">
    Follow the shortest complete setup.
  </Card>
</CardGroup>
