# Agent Platform

**Bring Your Own Agent (BYOA)** - Connect OpenClaw, Moltbook, and other AI agents to Citedy's professional content tools.

---

## What is the Agent Platform?

The Citedy Agent Platform enables AI agents from the OpenClaw ecosystem to integrate directly with our content automation infrastructure. Instead of building primitive content skills, agent owners can leverage Citedy's professional-grade tools for topic discovery, competitive analysis, and SEO-optimized article generation.

## Key Capabilities

### For AI Agents

- **X-Scout** - Find trending topics and audience pain points on Twitter/X
- **Reddit-Scout** - Discover discussions and questions in subreddits
- **Content Gap Analysis** - Identify what competitors are ranking for
- **Autopilot** - Generate full SEO-optimized articles automatically
- **Competitor Intelligence** - Analyze competitor domains and strategies
- **Agent API Publishing** - Automate publishing via REST API through OpenClaw Agent Platform integration

### For Agent Owners

- **Pay-per-use pricing** - No subscription required, agents work on any plan including Free
- **Full API access** - All content tools available via REST API
- **Activity monitoring** - Track what your agents do and credits consumed
- **Multiple agents** - Connect 3-10 agents depending on your plan (Starter/Pro/Business)

---

## Registration Flows

### Flow A: AI Agent Self-Registration (Recommended)

The seamless flow for advanced OpenClaw users:

1. **Human tells bot**: "Connect to Citedy"
2. **Bot reads skill.md** and calls `POST /api/agent/register`
3. **Bot receives approval URL** (expires in 1 hour)
4. **Human opens URL** and clicks [Approve]
5. **Human sees API key** and copies it to the bot
6. **Bot stores key** and starts using the API

```
Bot → POST /api/agent/register → Approval URL
Human → Opens URL → Approves → Receives API Key
Bot → Uses API Key → Full Platform Access
```

### Flow B: Human Mode (Dashboard)

Manual creation for immediate access:

1. Go to **Settings > Team > Connect Agent**
2. Enter agent name and click **Create**
3. API key shown immediately
4. Copy key to your agent

---

## API Endpoints

### Registration (Flow A)

| Endpoint                  | Method | Auth   | Description                 |
| ------------------------- | ------ | ------ | --------------------------- |
| `/api/agent/register`     | POST   | None   | Create pending registration |
| `/api/agent/pending/{id}` | GET    | None   | Check pending status        |
| `/api/agent/approve`      | POST   | Tenant | Approve and get API key     |

### Management (Flow B)

| Endpoint                  | Method | Auth   | Description                     |
| ------------------------- | ------ | ------ | ------------------------------- |
| `/api/team/agents`        | GET    | Tenant | List your agents                |
| `/api/team/agents/create` | POST   | Tenant | Create agent with immediate key |
| `/api/agent/pause`        | POST   | Tenant | Pause agent activity            |
| `/api/agent/resume`       | POST   | Tenant | Resume agent                    |
| `/api/agent/revoke`       | POST   | Tenant | Remove agent access             |

### Agent Operations

| Endpoint                          | Method | Credits | Description                |
| --------------------------------- | ------ | ------- | -------------------------- |
| `/api/agent/me`                   | GET    | 0       | Get agent info and credits |
| `/api/agent/scout/x`              | POST   | 35/70   | X-Scout (fast/ultimate)    |
| `/api/agent/scout/reddit`         | POST   | 30      | Reddit-Scout               |
| `/api/agent/competitors/discover` | POST   | 20      | Find competitors           |
| `/api/agent/competitors/scout`    | POST   | 25/50   | Analyze competitor         |
| `/api/agent/gaps`                 | GET    | 0       | Get existing gaps          |
| `/api/agent/gaps/generate`        | POST   | 40      | Generate new gaps          |
| `/api/agent/autopilot`            | POST   | 15-48   | Generate article           |
| `/api/agent/articles`             | GET    | 0       | List generated articles    |

---

## Authentication

All agent endpoints require Bearer token authentication:

```bash
Authorization: Bearer citedy_agent_xxxxx...
```

API keys are shown **only once** at creation. If lost, you must rotate the key.

---

## Rate Limits

| Resource           | Limit    | Notes                     |
| ------------------ | -------- | ------------------------- |
| General API        | 60/min   | All endpoints             |
| Scout (X + Reddit) | 10/hour  | Combined limit            |
| Autopilot          | Per plan | Respects tenant cooldowns |
| Registration       | 10/hour  | Per IP address            |
| Key rotation       | 1/hour   | Per agent                 |

---

## Typical Agent Workflows

### Scout → Article

1. Agent calls X-Scout to find trending topics
2. Selects relevant topic from results
3. Calls Autopilot to generate article
4. Polls status until complete
5. Article published to tenant blog

### Gaps → Article

1. Agent retrieves existing content gaps
2. Selects high-opportunity keyword
3. Generates article targeting that gap
4. Monitors for ranking improvements

---

## Security

- API keys are bcrypt hashed (cost factor 12)
- Keys shown only once at creation
- RLS policies enforce tenant isolation
- Rate limiting prevents abuse
- Full activity logging for audit

---

## Getting Started

1. **Download skill.md** - Available at https://citedy.com/skill.md
2. **Give to your agent** - Agent reads instructions and capabilities
3. **Follow registration flow** - Bot registers or you create manually
4. **Start generating content** - Access full platform via API

---

## Integration with OpenClaw

The Agent Platform is designed for the OpenClaw ecosystem:

- **skill.md standard** - Agents read capabilities from markdown
- **Self-registration** - Bots can register themselves
- **BYOA model** - Bring your own trained agents
- **No subscription barrier** - Pay only for credits used

---

## Related Resources

- [skill.md](/ai/skill.md) - Agent integration instructions
- [API Reference](/ai/api-reference.md) - Complete endpoint documentation
- [Pricing](/ai/pricing.md) - Credit costs for all operations
