Knowledge as of Oct 26, 2026
The Inference TimesReference architectures, tutorials, demos and free skills — by Nitin Goswami
Epoch III · Step 16Ask the AI Nitin →

REFERENCE ARCHITECTURE · internal-agent-sdk · October 19, 2026

What is an internal agent SDK? One shared way for many teams to build AI agents

A shared toolkit that lets every team in a company build AI agents the same safe way: each team writes only what is unique to its agent, and the SDK supplies the checks, the step-by-step runner, saved progress, human sign-off, model access and cost limits. Explained with two diagrams.

Domain
AI agents
Level
Intermediate
Key concepts
typed contracts · orchestrator · checkpoints · approval gate · model gateway · org policy · cost meter
Related demos
None yet

In one picture

An AI agent is a program where a language model decides, step by step, what to do next: answer, look something up, or use a tool (a function the agent is allowed to call, such as "reset a password"). An SDK (software development kit) is a ready-made toolkit that programmers build on. An internal agent SDK is that toolkit for agents, owned by one platform team and used by every other team in the company. Each team describes its agent. The SDK handles everything every agent needs.

Each team writes Helpdesk agent prompt · tools Invoice agent prompt · output shape Org policy models · budget · rules Shared SDK · same for every team Typed contracts check in & out Orchestrator runs the steps Model gateway one door to models Checkpoint store saves every step Approval gate a person says yes/no Cost meter stops at budget Main model Backup model specs valid prompt call if it fails save · resume risky step tokens · $
An internal agent SDK at a glance: teams write specs; the shared SDK checks them, runs the steps, saves progress, asks a person before risky steps, and sends every model call through one gateway.

Why it matters

Without a shared SDK, every team builds its own agent plumbing. Ten teams make ten different retry loops, keep API keys in ten places, and each has its own idea of when a person must approve an action. Nobody can say what all the agents together cost, or which of them can take actions in real systems. When a model provider has an outage, ten agents break in ten different ways.

A shared SDK makes three questions easy to answer:

  • What is this agent allowed to do, and who signs off on the risky parts? It's written in the agent's spec and the org's policy, not buried in code.
  • What happens when something fails halfway through? The run was saved after every step, so it picks up where it stopped.
  • What does each team spend, and on which models? Every model call goes through one gateway that counts it.

The building blocks

What each team writes:

PartHolds / doesEveryday example
Agent specThe agent's name, instructions (its prompt), the tools it may use, and the shape its answer must takeA job description: duties, permitted tools, what the deliverable looks like
ToolsSmall functions the agent can call, each with typed inputs and a risk levelThe equipment a new hire is issued, with the dangerous kit locked
Org policyWhich models a team may use, its spending budget, and which tools need a person's approvalA department's expense policy

What the SDK provides to everyone:

PartHolds / doesEveryday example
Typed contractsExact descriptions of every input and output (a request, a tool's arguments, the final answer), checked automatically. Data that doesn't fit is rejected with a clear error. Example library: Pydantic.A form with required fields that won't submit until it's filled in right
OrchestratorRuns the agent as a series of steps (think, use a tool, think again, answer), with a step limit and automatic retries when a step fails. Example: LangGraph.A project manager walking a checklist, and redoing a step that went wrong
Checkpoint storeSaves the agent's full state after every step, under a run id. A run can stop and resume later, even on another machine. Example: LangGraph checkpointers.Saving your game before the boss fight
Approval gatePauses the run before a risky tool, asks a person, and resumes with their yes or no. Example: LangGraph interrupts.A manager's signature on a purchase order
Model gatewayOne door to every model provider. Teams ask for a tier ("smart", "fast"), not a vendor. The gateway picks the model, switches to a backup if the main one fails, and holds the keys. Examples: LiteLLM proxy; LangChain as the model interface in code.A company travel desk: you say where you need to go; it books the airline, rebooks you if a flight is cancelled, and applies the travel policy
Cost meterCounts tokens (the units models charge by) and money per run and per team, and stops a team at its budget. Example: LiteLLM virtual keys with budgets.A prepaid company card with a monthly limit

Two of these are really memory. In the vocabulary of the CoALA framework (Sumers et al., 2023), the state the orchestrator passes between steps is the agent's working memory, and the checkpoint store plus an audit log of past runs is its episodic memory: a record of what happened.

How it works

Follow one request: an employee asks the IT helpdesk agent, "My VPN is broken."

  1. Check. The SDK checks the request against the agent's contract and the org policy. A malformed request stops here, before any model is paid for.
  2. Think. The orchestrator sends the conversation, the prompt and the list of allowed tools to the model through the gateway. The model replies with either a final answer or a request to use a tool, such as reset_vpn(user="ana").
  3. Gate. If the tool is marked risky, the approval gate pauses the run. The checkpoint store saves the exact state, and a person sees what the agent wants to do and why. The run can wait for minutes or days; nothing is held in memory.
  4. Act. On a yes, the run resumes from the checkpoint and the tool runs. If the tool fails for a temporary reason (say, a timeout), the orchestrator retries it a set number of times. On a no, the refusal goes back to the model as the tool's result.
  5. Repeat. The tool's result goes back to the model, and steps 2–4 repeat until the model has an answer or the run hits its step limit or budget.
  6. Answer. The final answer is checked against the agent's output contract (for example "a ticket with a status and a summary"). If it doesn't fit, the model is asked to fix it, a limited number of times. Then the typed result goes back to the caller, and the cost meter records what the run spent.
1 · Receive check against contract 2 · Think model, via the gateway 5 · Answer check shape, fix if wrong Done Tool loop · repeats 3 · Approval gate risky? pause first 4 · Run tool retry if it fails Person reviews minutes or days later checked request final answer result wants a tool tool result · next turn approved pause · state saved yes / no · resume
One request through an agent SDK: check, think, an optional pause for a person's approval, run the tool with retries, repeat, then check the answer's shape.

The team that built the helpdesk agent wrote none of steps 1–6. It wrote a prompt, two tools and one line saying reset_vpn needs approval.

Patterns & variations

PatternWhat changesWhen to use it
Single tool-calling loopThe shape in Fig. 2: one model, a set of tools, a loop until done. Anthropic calls the basic unit the "augmented LLM" (Anthropic, 2024)The default. Most team agents start and stay here
Fixed workflows: prompt chaining, routing (Anthropic, 2024)The orchestrator follows steps the team defined in advance instead of letting the model choose each stepPredictable tasks, like "extract invoice fields, then validate them"
Orchestrator–workers (Anthropic, 2024)One agent splits the job and hands parts to worker agents, each with its own spec and toolsBig jobs whose parts can't be known in advance
Shared tool servers (MCP)Tools live in separate servers that speak the Model Context Protocol, so many agents and teams reuse themWhen the same tools (search, ticketing) are needed by many agents
Gateway as a service vs. in the SDKThe gateway runs as its own service with central keys and budgets, or as code inside the SDKA service once you have more than a few teams; in-code for a prototype
Approval by risk tierLow-risk tools run freely, medium ones are logged, high-risk ones always need a person, following least-privilege advice (OWASP, 2025)Whenever agents touch real systems: money, accounts, customer data

Pitfalls

PitfallWhat you'll noticeRemedy
The SDK tries to do everythingTeams wait on the platform team for every change, or fork the SDKKeep the SDK to the shared parts in Fig. 1; let teams add their own tools and prompts freely
Vendor model names in team codeSwitching providers, or surviving an outage, means editing every agentTeams ask for tiers ("smart", "fast"); only the gateway knows vendors
Approvals without saved stateA pending approval is lost when a server restarts, and the person's "yes" goes nowhereSave a checkpoint before pausing; resume by run id
Trusting raw model outputDownstream systems crash on a missing field or a date in the wrong formatCheck every answer against its contract; re-ask on failure, then fail loudly
No step or spending limitA confused agent loops, calling tools and the model over and over, and the bill spikesA step limit in the orchestrator and a hard budget per team at the gateway
Approval fatiguePeople click "yes" without reading, because everything asksGate only high-risk tools, and show the exact action and reason on the approval screen

Go further

  • See it built: None yet. A good demo would be a small open-source SDK with two example "orgs" (an IT helpdesk agent with an approval step, an invoice reader with a typed output), a model gateway with a backup model and per-team budgets, and a web page for approving pending actions.
  • Read: Anthropic's Building effective agents (2024) for the patterns, then the LangGraph pages on persistence, interrupts and fault tolerance for how saving, pausing and retrying work in practice.
  • Next: CoALA: how language agents remember, decide and act gives the vocabulary for what an agent remembers and does. Explainers on agent harnesses and AI Ops are planned.

Credits & sources

  1. Erik S. and Barry Zhang (Anthropic). Building effective agents (2024)The augmented-LLM unit and the prompt-chaining, routing and orchestrator–workers patterns in the Patterns table.
  2. LangChain. Persistence (LangGraph docs)Checkpoints saved per run thread, used for the checkpoint store and resume.
  3. LangChain. Interrupts (LangGraph docs)Pausing a run and resuming it with a person's decision, used for the approval gate.
  4. LangChain. Fault tolerance (LangGraph docs)Per-step retry policies, used for retries in the orchestrator.
  5. LangChain. Models (LangChain docs)The model interface, and checking answers against a schema with structured output.
  6. LangChain. Structured output (LangChain docs)Returning answers that are validated against a Pydantic schema.
  7. Pydantic. Pydantic ValidationData validation from Python type hints, the example for typed contracts.
  8. LiteLLM. Fallbacks (Provider Failover)The gateway switching to a backup model when the main one fails.
  9. LiteLLM. Virtual KeysOne key per team, with spend tracked per key.
  10. LiteLLM. Budgets, Rate LimitsPer-team budgets, the example for the cost meter.
  11. OWASP Gen AI Security Project. LLM06:2025 Excessive Agency (2025)Least-privilege tools and human approval of high-impact actions.
  12. Model Context Protocol. What is the Model Context Protocol (MCP)?The shared-tool-servers variation.
  13. Theodore R. Sumers, Shunyu Yao, Karthik Narasimhan, Thomas L. Griffiths. Cognitive Architectures for Language Agents (2023)The working and episodic memory terms used in the building blocks.
  14. Original workThe split into "what each team writes" and "what the SDK provides", the multi-org policy layer, and both figures are new in this explainer, informed by the sources above.

More Reference Architectures

Reference Architecture · Agents

Agent memory over MCP: giving any model a long-term memory it can call

Agent memory over MCP puts an assistant's long-term memory in its own small server, so that any app that speaks the Model Context Protocol can save facts and look them up again. Explained with three diagrams and one worked example.

Reference Architecture · Voice AI

Grounded voice insight: turning recorded speech into claims you can check

A pattern for getting judgements out of recorded conversations that a reader can verify: transcribe, measure what can be counted, let an LLM judge the rest with quotes, and check every quote against the transcript before showing it. Explained with two diagrams.

Reference Architecture · Agents

CoALA: how language agents remember, decide and act

A reference architecture for thinking about any LLM agent: three kinds of long-term memory, a working memory where the model reasons, an action space, and a decision cycle that ties them together. Explained with two diagrams and one worked example.