api-agent AGENTS.md

Repository instructions for an API-to-MCP server: a service that lets users ask questions in ordinary language and retrieves data from GraphQL or REST APIs.

In plain words
What is it for?
Use it when changing the API server, schema loading, data processing, configuration, or tests.
Why use it?
It gives coding agents the project’s structure, testing commands, and rules for working safely in the codebase.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/agoda-com/api-agent/agents-md
Clone the repo
git clone --depth 1 https://github.com/agoda-com/api-agent

Made for: Codex, OpenCode.

Per session 826 This file is loaded in full into every session.
When invoked 826 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00826 $0.00826
Opus 5 $0.00413 $0.00413
Sonnet 5 $0.00165 $0.00165
Haiku 4.5 $0.00083 $0.00083

Measured 2d ago against content hash 51b3a472de33, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

api-agent AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 88 lines

How it starts

The opening of the file, as written. The whole thing — 88 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

Universal agent guidance for this repo.

Why

api-agent turns one GraphQL endpoint or REST OpenAPI spec into an MCP server. Users ask natural-language questions; the server introspects schema, calls the target API, stores tabular data in DuckDB, and runs SQL post-processing when the API cannot filter, rank, join, or aggregate directly.

What

  • api_agent/__main__.py: ASGI app, /mcp, /health
  • api_agent/config.py: TOML-only app settings; API_AGENT_CONFIG selects file path
  • api_agent/context.py: MCP request headers -> RequestContext
  • api_agent/tools/query.py: public {prefix}_query tool
  • api_agent/agent/: OpenAI Agents SDK GraphQL/REST flows
  • api_agent/rest/schema_loader.py: OpenAPI 3.x + Swagger 2.0 schema loading
  • api_agent/rest/polling.py: REST async polling tool
  • api_agent/recipe/: learned recipe extraction, storage, matching, tool exposure
  • api_agent/query_response.py: wrapped vs direct CSV response formatting
  • api_agent/executor.py: DuckDB SQL execution and result shaping
  • tests/: pytest coverage by module and behavior

How

Use deterministic tools first.

uv sync --group dev
uv run pytest tests/ -v
uv run pytest tests/test_foo.py::test_bar -v
uv run ruff check api_agent/ tests/
uv run ruff format --check api_agent/ tests/
uv run ruff format api_agent/ tests/
uv run ty check

Before pushing, run the CI lint shape:

uv sync --group dev && uv run ruff check api_agent/ && uv run ty check && uv run pytest tests/ -q

Run local server:

uv run api-agent
# public: http://localhost:3000/mcp

Run local server with tracing/debug:

OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 \
  uv run --no-sync opentelemetry-instrument api-agent

start.sh uses opentelemetry-instrument when an OTEL endpoint is set. Do not manually wire OpenAI Agents SDK trace exporters in app code; openai_agents auto-instrumentation should load OpenAIAgentsInstrumentor.

Useful local override:

Read the full file on GitHub · 88 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 88 lines · 826 tokens per session scan A 51b3a472de33

Subscribe to this mod's changes

api-agent AGENTS.md is an instructions file published in the GitHub repository agoda-com/api-agent (284 stars, last pushed 2mo ago), licensed MIT. It adds 826 tokens to every session, about $0.0041 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.