> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://platform.bctrl.ai/llms.txt.
> For full documentation content, see https://platform.bctrl.ai/llms-full.txt.

# Agent Context

> A machine-readable guide that tells coding agents how to use a space safely.

Agent Context gives an AI coding agent the current shape of a space: relevant runtimes, available operations, safety rules, examples, limits, and links back to the API reference.

Use it when an agent is writing scripts, repairing workflows, or choosing how to interact with BCTRL through the SDK or HTTP API.

## Fetch context

```ts
const context = await space.agentContext({
  runtimeId: runtime.id,
  detail: "compact",
});

for (const operation of context.operations) {
  console.log(operation.id, operation.path);
}
```

Request full examples when an agent needs copyable shapes:

```ts
const context = await space.agentContext({
  runtimeId: runtime.id,
  detail: "full",
  include: ["examples"],
});
```

## What it contains

| Field        | Purpose                                                      |
| ------------ | ------------------------------------------------------------ |
| `space`      | The current space boundary.                                  |
| `runtime`    | The selected runtime, when one is provided or inferable.     |
| `operations` | Valid operations relevant to the runtime, topic, and status. |
| `rules`      | Short constraints agents should follow.                      |
| `examples`   | Compact examples an agent can adapt.                         |
| `limits`     | Relevant account, space, or runtime limits.                  |
| `links`      | OpenAPI, docs, and `llms.txt` entrypoints.                   |

## How agents should use it

Agent Context is not a chat prompt. It is structured API guidance. Agents should read it before deciding whether to create a connection, inspect a run, download an artifact, or ask for more runtime state.

## Related

* [Spaces](/sdk/core-concepts/spaces)
* [Connections](/sdk/core-concepts/connections)
* [Runs](/sdk/core-concepts/runs)