Agent
In this section
- Build your agentWhat this room is for: after the counting method gives you a plan, these pages guide your coding agent to understand the work, choose the shape, design the experience, write the spec, govern it, build a basic text-only worker on the OpenAI Agents SDK, grade it, wrap it in FastAPI, ship it in a container to Vercel, test it end to end, and know where the record and the book continue. Every page is taken from The AI Agent Factory; only the Vercel steps come from Vercel's own docs.human:rrizwan98
- Is this an agent problem? Three gates before you buildBefore any agent is built, the three checks from The AI Agent Factory: does it need an agent at all, is it a once or an every-week task, and what does finished look like.human:rrizwan98
- Understand the work: five components, the window test, the delegation mapBefore a worker is designed, the method from The AI Agent Factory for reading the work itself: turn the request into a task definition, compute every number that matters, test each step against the window, and decide who owns each step by reversibility, stakes and accountability.human:rrizwan98
- From plan to worker: the four promotionsHow a counted, proven workflow becomes an agent: the readiness signal, and the four things you already did by hand that get promoted into a spec, an eval, exits and a runtime, from The AI Agent Factory.human:rrizwan98
- Choose the shape: five questions before you pick an architectureThe pattern-selection method from The AI Agent Factory: every pattern is a bet about the task, five questions route to the smallest pattern that fits, reflection and multi-agent are layers you earn with evidence, five failure signals tell you the bet was wrong, and cost and latency multiply with every layer you add. This room builds the single-agent shape; this page says when that is right and when you have outgrown it.human:rrizwan98
- Design the experience: trust, autonomy, recovery, and the machine surfaceHow a person comes to trust a worker that acts on its own, from The AI Agent Factory: the trust formula, first contact, progressive transparency, the five-stop autonomy dial, intent preview, honest waiting, repair and redress, the machine surface other agents parse, the surface as a safety control, the experience scorecard, the anti-patterns, and the eleven-section brief; plus what a test build from this record showed about feeling natural.human:rrizwan98
- Write the spec: what the agent does, never howThe spec-driven method from The AI Agent Factory applied to one agent: the spec as the product and code as a build output, the three levels, a short constitution, then research, a six-section spec that describes behaviour only, an interview that removes ambiguity, and a build that plans when the change earns it and verifies against the spec; the four artifacts, constitution, spec, plan and tasks, where they live in the repo, and what each one looks like.human:rrizwan98
- Govern it: four questions and one page before the worker runsThe governance procedure from The AI Agent Factory applied to one worker: can AI do this work, can this information go in, can this capability be turned on, could this affect someone unfairly; a defined gate as who, what, when; data tiers; the five checks on a skill or connector; the one-page Governance Record; the first hour after a bad output; and why architecture and record must tell the same story.human:rrizwan98
- Tests first: red, green, refactor on one sliceThe test-driven step from The AI Agent Factory: write one failing test before the code, keep the public interface tiny, test at the boundary, and let every pass be a checkpoint the agent cannot drift past.human:rrizwan98
- Build the text agent on the OpenAI Agents SDKThe basic text-only agent from The AI Agent Factory crash course: the three primitives, a stateful chat loop with sessions, streaming so the wait is honest, typed function tools, a blocking input guardrail, a tool guardrail, a human approval gate on the risky tool, tracing from day one, and the line a sandbox draws when a tool runs code.human:rrizwan98
- Loop and harness: stops, permissions and checks around the agentThe basic outer harness for the agent, from The AI Agent Factory: what a loop is made of, the three stops every loop needs, the five verbs of a harness, allow-ask-deny permissions sorted by blast radius, hooks, typed output and a progress file.human:rrizwan98
- Evals before shipping: grade the rate, not the runThe eval discipline from The AI Agent Factory applied to one worker: why tests are not enough, the three depths of a run, the golden set built from real failures, the judge as a model that needs calibrating, the bar as a decision, the regression baseline and the drift schedule, hold-outs against Goodhart, an unscripted set of questions nobody wrote in advance, and what evals cannot prove.human:rrizwan98
- Diagnose misbehaviour: four causes by timing, the cheapest fix first, and where the fix livesWhen a worker or an assistant disappoints, the procedure from The AI Agent Factory: tell four causes apart by when the symptom appeared, check the cheap things first, turn a reaction into an instruction, file the fix as a rule, a reference or a procedure, measure the before, and say what the system does without overstating it.human:rrizwan98
- FastAPI, Docker, Vercel: put the agent behind a URLWrap the text agent in a FastAPI harness, build the container image the book uses, and deploy it to Vercel from the official Vercel docs: Dockerfile.vercel, the PORT variable, project environment variables, vercel deploy, and the scale-in rules.human:rrizwan98
- Test end to end: laptop, container, live URLThe done-when checks from The AI Agent Factory applied at each stage of the basic agent: the harness on your laptop, the same harness inside the container, the deployed URL on Vercel, then the eval set and the harness gates against the live endpoint.human:rrizwan98
- Give it a record: the tables a worker runs against, the audit trail, and the MCP wireWhere the book continues after this room's basic worker, from The AI Agent Factory: every worker runs against a system of record; four tables every worker keeps; Postgres with pgvector over a separate vector store; the embedding pipeline; the audit trail written in the same transaction as the action; what MCP is and is not; a development plane that never reaches runtime; when a custom MCP server earns its keep over a plain function tool; reads run free, writes are gated, schema changes never reach production through the agent.human:rrizwan98
- Worked example: a first-reply support agent, start to URLThe book's own Tier-1 support agent taken through every page of this room: the three gates, the spec, the first test, the agent and its two tools, the harness, the eval that catches the wrong-account reply, and the done-when checks at the live URL.human:rrizwan98
- Write a skill: the description is the trigger, the body is the instructionsHow to write a skill a coding agent will actually reach for, from The AI Agent Factory and OpenAI's skill guidance: progressive disclosure and what it costs, the description formula and the delete-the-keyword test, an imperative body with real examples and edge cases, what belongs in a script instead of a sentence, one skill or several, where skills live, how to test the trigger, and why a skill has no scope of its own.human:rrizwan98
- The skill: download build-your-agent for your coding agentThe Build your agent room as a skill your coding agent can run: a SKILL.md in the Agent Skills format that says when each step happens, what it produces and where to stop, while every how stays on a page of this record. Eight non-negotiables, where the files go, ten steps with what done means, the progress file, how the skill adapts to any niche, and templates that are copies of this record's own. Download the zip, drop it in your tool's skills folder, attach the record, and start.human:rrizwan98
- Use another model: Gemini, Claude, Grok, DeepSeek or a local one, in the same harnessThe book's two ways to switch the model under the OpenAI Agents SDK, a base-URL swap for any OpenAI-compatible endpoint and LiteLLM for everything else, with the key check, the tracing caveat, the economy-versus-frontier split per agent, and what was verified on 2026-09-04: Gemini through both paths with a tool call, and a local llama.cpp model through the base-URL path; and on 2026-10-12, Claude through Anthropic's OpenAI-compatible endpoint and LiteLLM and Grok through xAI's Responses and Chat Completions endpoints and LiteLLM, each route reaching the provider, plus Gemini's free-tier gemini-3.1-flash-lite through both paths with a tool call.human:rrizwan98
- Demo or production: the opening round, two depths, one upgrade pathThe first thing this record settles with the person before any work is read: a demo (the default) or a production worker, which model provider and whether it is free or paid, and every other blank proposed in one pre-filled round; what each depth builds at each of the ten steps, what a demo leaves out on purpose, and how a demo becomes a production worker without starting again.human:rrizwan98
- The worker's page: chat, upload and Run behind one passwordWhat every worker built from this record is handed over as, at demo and at production depth: one web page with a password, an upload for the day's files, a Run button whose numbers come from code, and a chat box where the person asks in their own words and language, with off-topic requests politely refused and a daily limit that protects the model quota; the template, the instruction lines, the tests, and what a live check on 2026-10-12 showed.human:rrizwan98
Contact
How to reach Raza Rizwan, what to bring to a first conversation, and what happens in a workflow audit.
Build your agent
What this room is for: after the counting method gives you a plan, these pages guide your coding agent to understand the work, choose the shape, design the experience, write the spec, govern it, build a basic text-only worker on the OpenAI Agents SDK, grade it, wrap it in FastAPI, ship it in a container to Vercel, test it end to end, and know where the record and the book continue. Every page is taken from The AI Agent Factory; only the Vercel steps come from Vercel's own docs.