---
title: Serving Agents
description: Expose your context to Claude Code, Cursor, Codex, and other coding agents.
---

Once you've built and refined your context, expose it to coding agents through
the public KTX CLI. Claude Code, Cursor, Codex, OpenCode, and custom agent
workflows can call the same commands you use at a terminal.

## CLI Commands

KTX public commands support JSON output for the context reads that agents use
most often. Use `--project-dir` when the agent is not already running inside the
KTX project directory.

### Available commands

```bash
# Check setup and context readiness
ktx status --json
```

**Semantic layer:**

```bash
# List sources
ktx sl list --json
ktx sl list --json --connection-id my-postgres
ktx sl list --json --query "revenue"

# Read a source
ktx sl read orders --json --connection-id my-postgres

# Run a query from a JSON file
ktx sl query --json \
  --connection-id my-postgres \
  --query-file query.json \
  --execute \
  --max-rows 100
```

**Knowledge:**

```bash
# Search knowledge pages
ktx wiki search "revenue recognition" --json --limit 10

# Read a specific page
ktx wiki read order-status-definitions --json
```

## Setting Up Your Agent

The fastest way to connect an agent is through the setup wizard:

```bash
ktx setup
```

The agents step auto-detects installed tools and generates the right
configuration. For manual setup or per-tool details, see the
[Agent Clients](/docs/integrations/agent-clients) integration page.

After configuration, the agent can immediately call KTX commands to list
sources, search knowledge, and query your semantic layer.
