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

# Agent Operating Layer

> Saved workflow templates, reusable query packs, billing-aware agent guardrails, and policy bundles

The Agent Operating Layer provides infrastructure for running AI agents at scale against SEC API — with guardrails, templates, and billing controls.

## Workflow Templates

Pre-built workflow templates that agents can execute with a single prompt:

### Earnings Prep

```
"Prepare an earnings preview for {ticker} using SEC API"
```

Automatically calls: `intelligence/earnings-preview`, `factors/decomposition`, `insiders`, `owners/13f`

### Compliance Check

```
"Run a compliance check on {company} using SEC API"
```

Automatically calls: `events/enforcement`, `compensation`, `insiders`, `filings` (8-K events)

### Portfolio Review

```
"Review my portfolio using SEC API"
```

Automatically calls: `portfolio/analyze`, `portfolio/stress-test`, `factors/dashboard`

## Query Packs

Reusable query configurations that bundle multiple API calls:

```json theme={null}
{
  "name": "weekly-insider-review",
  "queries": [
    {"endpoint": "/v1/insiders", "params": {"ticker": "{ticker}", "limit": 20}},
    {"endpoint": "/v1/owners/13f", "params": {"cik": "{manager_cik}"}},
    {"endpoint": "/v1/events/enforcement", "params": {"respondent": "{company_name}"}}
  ],
  "schedule": "weekly",
  "output": "markdown"
}
```

## Billing-Aware Agent Guardrails

### Budget Controls

Set per-agent spending limits to prevent bill shock:

```bash theme={null}
# Set a $10/month budget for an agent
curl -X PUT "https://api.secapi.ai/v1/billing/budget" \
  -H "x-api-key: $SECAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"spendCapCents": 1000, "softCapCents": 750}'
```

The agent receives `SECAPI-Budget-Used` headers on every response and gets warned at 75%, 90%, 95% thresholds.

### Rate Limiting

Per-endpoint rate limits prevent agents from overwhelming the API:

| Endpoint Family    | Rate Limit |
| ------------------ | ---------- |
| Entity resolve     | 600/min    |
| Filing search      | 600/min    |
| Section extract    | 180/min    |
| Intelligence query | 30/min     |
| Semantic search    | 120/min    |

### Agent Bootstrap

Create ephemeral, scoped credentials for agents. The sponsor-token endpoint requires a WorkOS-authenticated bearer token, not an API key.

```bash theme={null}
# Sponsor creates a bootstrap token
curl -X POST "https://api.secapi.ai/v1/agent/bootstrap_tokens" \
  -H "Authorization: Bearer $SECAPI_BEARER_TOKEN" \
  -d '{"ttlSeconds": 3600, "scopes": ["read:sec"]}'

# Agent exchanges token for credentials
curl -X POST "https://api.secapi.ai/v1/agent/bootstrap" \
  -d '{"token": "BOOTSTRAP_TOKEN"}'
```

## Policy Bundles by Vertical

Pre-configured policy sets for different customer types. For ready-to-run prompts that exercise these policy bundles end-to-end, see the [agent prompt library](/agents/prompt-library) — 50 v1 prompts across the same five personas.

### Investment Manager Policy

* Full access to all SEC, factor, and macro endpoints
* Intelligence bundles enabled
* Portfolio analytics enabled
* Budget: usage-based (PAYG or Team plan)
* 12 ready-to-run prompts: [/agents/prompt-library/investment-manager](/agents/prompt-library/investment-manager)

### Law Firm Policy

* Enforcement, filing search, entity resolution
* Event monitoring (8-K, restatements, auditor changes)
* Webhook delivery for real-time alerts
* Budget: per-query with approval threshold
* 12 ready-to-run prompts: [/agents/prompt-library/law-firm](/agents/prompt-library/law-firm)

### Insurance/Risk Policy

* Financial health indicators
* Enforcement history
* Compensation screening
* Restricted to read-only operations
* Budget: fixed monthly cap
* 6 ready-to-run prompts: [/agents/prompt-library/insurance](/agents/prompt-library/insurance)

## Monitoring

Export detailed event logs:

```bash theme={null}
curl "https://api.secapi.ai/v1/delivery/events/export?format=ndjson" \
  -H "x-api-key: $SECAPI_API_KEY"
```
