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

# AI Agents

> Configure once, get content forever — autonomous agents generate and publish social posts on a schedule using your knowledge base and brand guidelines.

AI Agents run on a schedule to generate content ideas grounded in your knowledge base, then create post drafts — or publish immediately. Configure once and get a steady stream of on-brand content without manual effort.

## How It Works

<Steps>
  <Step title="Agent triggers">
    Scheduler polls agents due to run. Supports `daily`, `weekly`, or `manual` triggers with a configurable time window and timezone.
  </Step>

  <Step title="Knowledge retrieval">
    Agent queries your knowledge base using vector similarity and graph traversal, then assembles a grounded context prompt.
  </Step>

  <Step title="LLM generation">
    AI generates structured ideas — each with title, hook, angle, target platform, and virality score.
  </Step>
</Steps>

## Create an Agent

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://app.autoposting.ai/api-proxy/agents \
    -H "Authorization: Bearer sk_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Weekly LinkedIn Insights",
      "type": "publish",
      "brandSlug": "brand_slug",
      "kbId": "kb_id",
      "frequency": "weekly",
      "weekday": "mon",
      "time": "09:00",
      "timezone": "America/New_York",
      "platforms": ["linkedin"],
      "postsPerRun": 3,
      "autoPublish": false
    }'
  ```

  ```typescript TypeScript theme={null}
  const res = await fetch("https://app.autoposting.ai/api-proxy/agents", {
    method: "POST",
    headers: {
      Authorization: "Bearer sk_your_api_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      name: "Weekly LinkedIn Insights",
      type: "publish",
      brandSlug: "brand_slug",
      kbId: "kb_id",
      frequency: "weekly",
      weekday: "mon",
      time: "09:00",
      timezone: "America/New_York",
      platforms: ["linkedin"],
      postsPerRun: 3,
      autoPublish: false,
    }),
  });
  const { data } = await res.json();
  ```
</CodeGroup>

## Configuration Reference

| Field              | Type                            | Description                                                    |
| ------------------ | ------------------------------- | -------------------------------------------------------------- |
| `type`             | `publish` \| `research`         | `publish` creates post drafts; `research` generates ideas only |
| `frequency`        | `manual` \| `daily` \| `weekly` | Run schedule                                                   |
| `time` / `timeEnd` | `HH:MM`                         | Time window in 24h format                                      |
| `weekday`          | `mon`–`sun`                     | Day of week (weekly agents only)                               |
| `contentSource`    | `kb` \| `news` \| `both`        | Idea sourcing — KB, trending news, or both                     |
| `postsPerRun`      | 1–50                            | Ideas or posts to generate per run                             |
| `autoPublish`      | boolean                         | Publish immediately vs. create as draft                        |
| `prompt`           | string                          | Custom instructions (20–1,000 chars)                           |
| `writingStyle`     | string                          | Writing style guide (up to 4,000 chars)                        |
| `notifyEmail`      | boolean                         | Email notification after each run                              |

## Tone Presets

`concise` · `playful` · `professional` · `thought-leader` · `casual` · `storyteller` · `breaking-news` · `controversial` · `product-launch` · `educational` · `inspirational` · `satirical`

## Trigger Manually

Run an agent immediately regardless of its schedule:

```bash theme={null}
curl -X POST https://app.autoposting.ai/api-proxy/agents/:id/run-now \
  -H "Authorization: Bearer sk_your_api_key"
```

## Run Statuses

| Status      | Description                           |
| ----------- | ------------------------------------- |
| `pending`   | Queued, not yet started               |
| `running`   | LLM pipeline executing                |
| `succeeded` | All requested posts or ideas created  |
| `partial`   | Some artifacts succeeded, some failed |
| `failed`    | All artifacts failed                  |

<Warning>
  When an organization's subscription is suspended, all running agents are automatically paused and resume within one minute of billing being restored.
</Warning>

<CardGroup cols={2}>
  <Card title="Knowledge Base" icon="book" href="/concepts/knowledge-base">
    Upload documents to ground agents in proprietary knowledge.
  </Card>

  <Card title="Brands" icon="building" href="/concepts/brands">
    Agents inherit brand timezone and connected accounts.
  </Card>

  <Card title="Posts" icon="paper-plane" href="/concepts/posts">
    Agent-created drafts enter the standard post publishing pipeline.
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/overview">
    Full endpoint reference for agent management and run history.
  </Card>
</CardGroup>
