Let a coding agent customize a generated SDK safely
Point the agent at the levers under .sdk/, never at the generated tree, and prove with doctor and a regeneration diff that only the intended files move.
How-to › Section 9
Coding agents, MCP clients, agent frameworks, structured output, evals, observability, cost and safety on the consuming side.
12 guides in 6 topics. Every guide compares its approaches and shows the output its commands printed.
Getting Claude Code, Cursor, Copilot, Codex CLI, Gemini CLI, Aider or Cline to write an API integration: prompting with the spec, feeding an SDK, a catalog SDK, a skill or the API's MCP server, stopping the agent inventing endpoints, reviewing generated code for missing retry and error handling, test-first loops, running the agent in a sandbox with a mock API, keeping generated files out of agent edits, and the experiments: measuring drift between two AI-written clients from one spec, comparing an AI-written client with generator output, and the hybrid workflow where an agent customizes a generated SDK without breaking regeneration.
Point the agent at the levers under .sdk/, never at the generated tree, and prove with doctor and a regeneration diff that only the intended files move.
Give a coding agent a read-only probe of the real API while it writes the client, and check what came back against the document before the agent hard-codes it.
Compare two clients written from the same description and separate what one of them missed from what neither was told.
Make an invented path a compile error, refuse the rest at a validation proxy, and review casts as well as tests, because an instruction on its own leaks.
Name the spec, the auth scheme, the language, the test command, and the done criteria in one task prompt, then check the agent's result against them yourself.
Wiring an MCP server into Claude Desktop, Claude Code, ChatGPT, Cursor, Cline, VS Code and custom clients: stdio versus remote configuration, OAuth in client config, restricting which tools an agent may call, running several servers at once, composing servers behind one gateway (mcp-proxy), running a stdio server as a subprocess from a Python agent, health checks, debugging with MCP Inspector, and using catalog MCP servers, aontu-mcp and the tabnas mcp server as ready-made examples.
Get a remote MCP server answering tool calls in Claude Desktop, as a custom connector or through a stdio bridge, and probe its transport before blaming the config.
Keep Claude Code, Cursor, VS Code, and Cline on the same MCP servers by rendering four editor files from one source, and see why a copied file loads zero servers.
Agent loops and frameworks: Claude Agent SDK, OpenAI Agents SDK, LangGraph, Vercel AI SDK, Mastra, CrewAI; wrapping a typed SDK as tools, converting OpenAPI operations into function schemas, auth passthrough, pagination in tool results, parallel tool calls, long-running operations, streaming tool output, multi-step workflows (Arazzo as a description format), and calling SDKs directly versus through MCP.
Register a typed client's operations as function tools, run the loop, hand off between two agents on one client, and keep a failed call from ending the run.
Making a model emit valid data: JSON Schema structured outputs, tool-call schemas used as output, GBNF and Lark grammars for constrained decoding (llama.cpp, vLLM, Outlines, guidance), repairing malformed or truncated JSON, validating with Zod, Pydantic or gubu and retrying, and generating grammars from a spec (the aontu GBNF and Lark output and the tabnas GBNF grammar as options).
Get a typed value out of a model response that is only mostly JSON, and refuse the responses that are the wrong shape instead of letting them into your code.
Evals (promptfoo, Braintrust, Inspect, LangSmith, custom harnesses), golden traces, task success rates across model providers, regression suites for tool use recorded from real traffic, tracing with OpenTelemetry GenAI semantic conventions (Langfuse, Phoenix, Helicone, OpenLLMetry), token and cost accounting, per-task budgets as cutoffs versus hard caps (the sdkgen cost feature as one example with its limit stated), caching tool results across steps, prompt caching, model routing.
Order the request so the stable prefix comes first and the growing conversation last, place the breakpoints, and measure cache reads against a baseline run.
The agent side of safety: prompt injection defence for tool results, web pages and documents, isolating untrusted content, output filtering, allow lists, human-in-the-loop approval before destructive calls (this branch owns approval), MCP elicitation, dry-run modes, sandboxing, least privilege per tool, spend and blast-radius limits, guardrail libraries (OpenAI Agents SDK guardrails, Guardrails AI, NeMo Guardrails, Llama Guard), and testing against an injection corpus.
Run what an agent executes inside a boundary with no credentials, a scratch filesystem and a closed network, in Docker, a sandbox service or an OS-level sandbox.
Extract readable text, strip zero-width characters, normalize to NFKC, cut to a byte budget, and wrap the result in a delimiter the system prompt names as data.
Retries, timeouts, pagination and auth are the same problems in every client. Voxgig generates them from your OpenAPI description, in 23 languages, from one model.