Author from one example
Have an agent emit a stitch declaration from a single curl, HAR, or doc snippet.
An agent can write a complete stitch from one example — a curl, a HAR entry, a
doc snippet — because a stitch is declarative and atomic: it needs only a URL and
one example, never an OpenAPI spec and never codegen. The agent reads the
example, maps its parts onto the authoring surface, and emits a stitch({...})
declaration — the same surface a human writes by hand.
Example
Give the agent a single curl:
curl https://api.example.com/users/1It emits the stitch that example describes:
import { } from 'stitchapi';
const = ({
: 'https://api.example.com',
: '/users/{id}',
: 'GET',
});
await ({ : { : 1 } });That declaration is the whole integration — no spec to ingest, no generated code to commit.
Options
The agent maps each part of the one example onto a config field:
- URL →
baseUrl+path. The origin becomesbaseUrl; the rest becomespath, with concrete segments lifted into{param}slots (so/users/1becomes/users/{id}, called with{ params: { id: 1 } }). - Headers →
auth/headers. AnAuthorization: Bearer …orx-api-keyheader becomes anauthstrategy resolved at call time; other headers become staticheaders. - An example response → an
outputschema. When the example carries a response body, the agent can add anoutputschema — turning one move into TypeScript types, runtime validation, and drift detection.
This works because a stitch is atomic, not spec-first — no OpenAPI document, no
codegen step. And what the agent emits is the normal authoring surface: a plain
stitch({...}) declaration, identical to a hand-written one, that you can read,
review, and extend.
The emitted stitch({...}) is the same call documented in
stitch() — add an output schema with
validation exactly as you would for a
hand-authored stitch.