# AI agent quickstart

Source: https://docs.graphops.xyz/ai-agent-quickstart

Get your coding agent working with GraphOps from one prompt. The setup prompt has your agent
install the GraphOps agent skills, connect the docs MCP server and tell you which API keys to set.
The task prompts then take it to a first working integration.

Every prompt starts by sending the agent to `https://docs.graphops.xyz/AGENTS.md`, which points it
to the skills, the docs and the error reference. Replace the text in square brackets before you
send a prompt.

## Before you start

* A coding agent that can read web pages and run commands, such as Claude Code.
* A GraphOps account with credits. Requests your agent sends use credits like any other request.

## Set up your project

Paste this prompt into your agent from your project's directory:

```text
Set up GraphOps for this project. Read https://docs.graphops.xyz/AGENTS.md and follow it. Ask me before you install anything, then install the GraphOps agent skills and connect the GraphOps docs MCP server. Tell me which API key environment variables this project needs. I'll set them myself, so don't ask me to paste a key into this conversation.
```

Your agent asks before it installs anything, then lists the environment variables your project
needs. Create a key for each service in [API keys](/platform/api-keys) and
set the variable in the environment your agent's commands run in. Don't paste keys into the
conversation.

## Build your first integration

Choose the prompt that matches your task.

### Choose a data service

```text
Read https://docs.graphops.xyz/AGENTS.md and follow it. My application needs to [describe the data your application reads and how fresh it must be] on [the networks you need]. Recommend GraphOps RPC, Subgraphs or Substreams for it, explain the tradeoff, and check that the service supports those networks.
```

### Read chain state with RPC

```text
Read https://docs.graphops.xyz/AGENTS.md and follow it. Use the graphops-rpc skill to write a [language] function that [reads the chain data you need, such as a token balance] on [network] through GraphOps RPC. Read the API key from GRAPHOPS_RPC_API_KEY, keep every request bounded, and report the block number the data was read at.
```

### Query a Subgraph

```text
Read https://docs.graphops.xyz/AGENTS.md and follow it. Use the graphops-subgraphs skill to write a [language] function that queries [the Graph Network Subgraph ID, Deployment CID or Endpoint Alias] for [the entities you need] through GraphOps Subgraphs. Read the API key from GRAPHOPS_SUBGRAPHS_API_KEY, paginate the results, handle GraphQL errors, and report the block the data was indexed at.
```

### Stream data with Substreams

```text
Read https://docs.graphops.xyz/AGENTS.md and follow it. Use the graphops-substreams skill to stream [the Substreams package and module] on [network] from block [start block] to [end block] through GraphOps Substreams, writing the output to [where the data goes]. Read the API key from SUBSTREAMS_API_KEY, save the cursor after each committed batch, and resume from it after a restart.
```

## Check the result

With the GraphOps skills loaded, your agent reports how fresh its data is with every answer: the
block number for RPC, the indexed block for Subgraphs, or the cursor for Substreams. If its answer
leaves that out, ask it to read `https://docs.graphops.xyz/AGENTS.md` again and follow the GraphOps
skills.

## Fix a failed request

When a request fails, give your agent the error and let it look up the cause:

```text
Read https://docs.graphops.xyz/AGENTS.md and follow it. My GraphOps request failed with [the error code, HTTP status or response body, with any API key removed]. Use the GraphOps error reference to explain the cause, then fix the code. If the error means a missing or disabled key, exhausted credits or paused access, stop and tell me what to do instead of retrying.
```

## Next steps

* [Use GraphOps with AI agents](/ai-agents): Install the skills by hand, connect the docs MCP server, and keep the skills current.
* [Production readiness](/production-readiness): Review credentials, limits and retries before your agent's code ships.
* [Error reference](/platform/errors): Look up an error code your agent reported.