> ## 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.

# Build an agent in two minutes

> Create version 1, run it, and continue its agent chat with the shortest valid workflow.

If you already have a knowledge base with at least one processed document, you can create and run an agent in about two minutes.

<Info>
  Creating an agent publishes version 1. You do not need a separate deploy call before the first run.
</Info>

## Dashboard: the two-minute path

<Steps>
  <Step title="0:00 — Open Agents">
    In the dashboard, open **Agents** and choose **Create agent**.
  </Step>

  <Step title="0:20 — Choose the knowledge base">
    Select the KB with your processed documents. This choice is fixed after creation, so use Copy if you later need the configuration on another KB.
  </Step>

  <Step title="0:40 — Define the job">
    Add a clear name, one-sentence goal, focused instructions, and a model. Leave tools, memory, and scheduling off for the first test.
  </Step>

  <Step title="1:10 — Create version 1">
    Save the agent. AutoSage validates the configuration and publishes its first version.
  </Step>

  <Step title="1:30 — Run it">
    Send one realistic request. Open the run to inspect its status, answer, sources, usage, and associated chat.
  </Step>
</Steps>

### Starter configuration

| Field          | Example                                                                                          |
| -------------- | ------------------------------------------------------------------------------------------------ |
| Name           | Support specialist                                                                               |
| Goal           | Answer customer questions from approved support documentation.                                   |
| Instructions   | Cite supporting sources. If the KB does not contain the answer, say so and recommend escalation. |
| Model          | Choose an available model                                                                        |
| Knowledge base | Your processed support KB                                                                        |

## API: create and run

```bash theme={null}
export AUTOSAGE_URL="https://api.autosage.ai/api/v1"
export AUTOSAGE_KEY="sk_live_your_key_here"
```

### 1. Create version 1

```bash theme={null}
AGENT_RESPONSE=$(curl --fail --silent --show-error \
  -X POST "$AUTOSAGE_URL/agents" \
  -H "Authorization: Bearer $AUTOSAGE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tenant_id": "TENANT_ID",
    "name": "Support specialist",
    "goal": "Answer customer questions from approved support documentation.",
    "instructions": "Cite supporting sources. If the KB does not contain the answer, recommend escalation.",
    "model_id": "MODEL_ID",
    "selected_knowledge_base_id": "KB_ID",
    "web_search_enabled": false,
    "use_memory_enabled": false
  }')

AGENT_ID=$(printf '%s' "$AGENT_RESPONSE" | jq -r '.agent.id')
printf 'Agent: %s\n' "$AGENT_ID"
```

### 2. Start a run

```bash theme={null}
curl --fail --silent --show-error \
  -X POST "$AUTOSAGE_URL/agents/$AGENT_ID/messages" \
  -H "Authorization: Bearer $AUTOSAGE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "A customer bought an item 20 days ago. Can they return it?"
  }'
```

The response includes `run_id`, `chat_id`, the answer, sources, and usage. Save `chat_id` if you want to continue the same agent conversation.

### 3. Continue the run

```bash theme={null}
curl -X POST "$AUTOSAGE_URL/agents/$AGENT_ID/messages" \
  -H "Authorization: Bearer $AUTOSAGE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Turn that answer into a reply I can send.",
    "chat_id": "AGENT_CHAT_ID"
  }'
```

## Add capabilities after the first run

Once the basic run works, deploy a new version to add web search, durable memory, connected apps, MCP servers, skills, custom tools, callable agents, or a schedule. Deploy accepts the complete agent configuration and publishes the next numbered version.

## Continue the learning path

<CardGroup cols={2}>
  <Card title="KB prompts vs. agents" icon="scale-balanced" href="/guides/kb-prompts-vs-agents">
    Put shared behavior and job-specific behavior in the right place.
  </Card>

  <Card title="Chat vs. agent runs" icon="arrows-left-right" href="/guides/chat-vs-agent-runs">
    Understand the run and associated chat you just created.
  </Card>

  <Card title="Configure capabilities" icon="sliders" href="/agents/configuring">
    Add tools, skills, memory, delegates, and schedules.
  </Card>

  <Card title="Agents API" icon="code" href="/developers/api/agents">
    See every agent endpoint and field.
  </Card>
</CardGroup>
