ktx/docs-site/content/docs/guides/serving-agents.mdx

77 lines
1.8 KiB
Text
Raw Permalink Normal View History

---
title: Serving Agents
description: Expose your context to Claude Code, Cursor, Codex, and other coding agents.
---
2026-05-12 23:51:46 +02:00
Once you've built and refined your context, the final step is exposing it to
coding agents. KTX provides machine-readable CLI commands for direct terminal
access from Claude Code, Cursor, Codex, OpenCode, and custom agent workflows.
## CLI Commands
2026-05-12 23:51:46 +02:00
KTX provides a set of machine-readable commands under `ktx agent`. These return
JSON output designed for programmatic consumption.
### Available commands
```bash
# List available tools and their descriptions
ktx agent tools --json
# Get project context for planning
ktx agent context --json
```
**Semantic layer:**
```bash
# List sources
ktx agent sl list --json
ktx agent sl list --json --connection-id my-postgres
# Read a source
ktx agent sl read orders --json --connection-id my-postgres
# Run a query from a JSON file
ktx agent sl query --json \
--connection-id my-postgres \
--query-file query.json \
--execute \
--max-rows 100
```
**Knowledge:**
```bash
# Search knowledge pages
ktx agent wiki search "revenue recognition" --json --limit 10
# Read a specific page
ktx agent wiki read order-status-definitions --json
```
**SQL execution:**
```bash
# Execute read-only SQL with a row limit
ktx agent sql execute --json \
--connection-id my-postgres \
--sql-file query.sql \
--max-rows 500
```
## Setting Up Your Agent
The fastest way to connect an agent is through the setup wizard:
```bash
ktx setup
```
2026-05-12 23:51:46 +02:00
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.
2026-05-12 23:51:46 +02:00
After configuration, the agent can immediately call KTX commands to list
sources, search knowledge, and query your semantic layer.