<!-- source: https://www.secondlayer.tools/docs/agents -->

# Agents

Give your agent the rules, the docs as Markdown, and live state.

## Start Here

The Quick Start prompt on [Get Started](https://www.secondlayer.tools/docs/introduction.md#quick-start) sets up all three for your agent. Pick by what the agent needs.

| Use | When the agent |
| --- | --- |
| [Skill](https://www.secondlayer.tools/docs/skills.md) | Writes code against Secondlayer and needs the rules it gets wrong without them |
| [Connect an Agent](https://www.secondlayer.tools/docs/mcp.md) | Needs live state: your subgraphs, webhooks, chain tips |
| [Docs as Markdown](#docs-as-markdown) | Needs a page, an endpoint or the whole site as text |

## Docs as Markdown

Every docs page is plain text for an agent, with no HTML to strip.

| URL | Holds |
| --- | --- |
| `/llms.txt` | Shortest path, products, and a link to every page |
| `/llms-api.txt` | Every endpoint as a Markdown URL |
| `/llms-full.txt` | Every guide in one file |
| `/docs/<page>.md` | Any docs page, as Markdown |
| `/docs/api-reference/<anchor>.md` | One endpoint or object from the API reference |

Page twins end with a Notes for agents section: the rules an agent must follow on that page.

## Read next

- [Get Started](https://www.secondlayer.tools/docs/introduction.md)
- [Skill](https://www.secondlayer.tools/docs/skills.md)
- [Get Started](https://www.secondlayer.tools/docs/mcp.md)

## Notes for agents

- Fetch 'https://www.secondlayer.tools/llms.txt' to orient, then '/docs/<page>.md' for one page. '/docs' itself is '/docs/introduction.md'; '/docs/index.md' is the Index product page.
- '/docs/api-reference/<anchor>.md' is one endpoint; '/llms-api.txt' lists them all. '/llms-full.txt' holds every guide.
- Skill for rules, MCP for live state, Markdown for reading: /docs/skills, /docs/mcp.

## Setup

Ensure setup once, skipping any step already done:
- CLI: `bun add -g @secondlayer/cli`
- Instance: `secondlayer init` writes `INSTANCE_TOKEN`. Loopback `/v1` reads need no key.
- Hosted reads: export `SECONDLAYER_API_KEY` (`sk-sl_*`) or buy credits with `secondlayer credits buy` (`balance`, `refill`), then `secondlayer whoami`
