5 Ways to Give AI Agents Deterministic API Context

6 Ways to Give AI Agents Deterministic API Context

Posted in

At PayPalDevDay 2025, PayPal’s Nathaniel Olson discussed a familiar problem. When he asked an AI coding assistant to build a product involving APIs, it was far too common for the AI to use outdated APIs rather than the most current iterations. It’s not that the official documentation or SDKs weren’t up-to-date, it’s the fact that the AI agent never checked them in the first place.

Despite all appearances to the contrary, AI isn’t really a reasoning machine. LLMs like ChatGPT, Google Gemini, or LLaMA are actually “stochastic parrots.” In other words, they’re mathematical models approximating what a person is most likely to say based on probability. This raises the likelihood of an LLM generating outdated code exponentially, as odds are good the AI was trained on outdated data. Even worse, the AI’s limitations may not be immediately obvious, as you have no way of knowing what data the AI is using. To use AI effectively, you have to know what it knows. You also have to be able to predict its outputs for it to be truly useful, especially for coding and development.

This is where API context comes into play. Not only do you need to know what data and resources are being used by an AI agent, you also need a way to direct agentic AI towards the right data, tools, and services. You also need a way to make the AI consistent and replicable, which has come to be referred to as deterministic AI.

Deterministic API context ensures AI agents produce consistent outputs given the same inputs. Below, we’ll explore what deterministic API context entails, and highlight the emerging strategies for supplying more API-related context at runtime to AI coding assistants.

Why Deterministic API Context Matters

Thoughtworks recently published an engineering brief discussing some of the challenges of updating an existing API, especially if it’s well-established. They cite a case study where they overhauled an existing B2B app that’s powered by over 25 APIs. In their case study, they discuss the headache of trying to work with such a complex system that quickly becomes tightly coupled and frighteningly brittle. To make matters worse, a legacy product like that might be using an outdated stack that your current team doesn’t even know what to do with. Would your team even know how to debug a problem if it came up?

To mitigate these risks, Thoughtworks created a framework to create a deterministic AI system. To modernize their system, they created version-controlled instruction files as YAML or JSON files, directing the AI how to translate deprecated APIs to the most current version, replace outmoded namespaces or dependencies, build or configure conventions, rules for validating tests, and how to fix common error patterns.

Detailed instructions remove all the guesswork for an AI agent, telling it exactly what it needs to do in different circumstances. It’s an important guardrail from simply letting an AI agent off the leash.

6 Ways to Implement Deterministic API Context

Thoughtworks’ case study is just one example of ongoing efforts to supply agentic AI workflows with better context. However, other practices are also emerging that give AI-driven API orchestration a bit more structure.

1. Agent Skills

Agent skills are one way that developers have been introducing context into agentic AI ecosystems. When an agent determines some sort of action needs to happen, it goes looking for the right tool for the job. Once it selects the right tool, the agent formats the query into an appropriate format for the function. Once the task is complete, the results are returned back to the AI in a prescribed format.

Agent skills provide an important step towards an agentic AI system becoming truly deterministic. They’re just a step in the right direction, though, as the LLM still relies on probabilistic tokens to generate its responses. Agent skills just help to constrain the inputs and outputs into an appropriate format. They’re also meant primarily for single agents. Alternate protocols like Autogen have emerged to orchestrate multi-agent workflows.

2. Deterministic Chains

Deterministic chains are an even more intense way to enforce consistency in agentic AI systems. Instead of allowing an agent to cast about for the right tool, it forces the tool to use an intense, predefined workflow. This is a good approach for relatively simple agentic systems that don’t require making real-time decisions, like retrieval-augmented generation (RAG) systems or systems executing simple, well-defined tasks.

While deterministic chains are an even greater step towards a truly deterministic agentic AI ecosystem, it’s also unwieldy and impractical. Anybody looking for reliable, consistent results outside of a strictly defined pipeline or workflow will need to find a different way to introduce deterministic AI into their workflow.

3. Context Plugins

Context Plugins, a new feature from SDK company APIMatic, are the newest solution for giving agentic AI more deterministic API context. As APIMatic’s co-founder and CEO Adeel Ali tells Nordic APIs, “agent skills define what the agent can do. Context Plugins define what it knows with high confidence.”

Ali goes on to describe why Context Plugins are uniquely useful for agentic workflows. “Skills can orchestrate workflows, but they still rely on the underlying context,” he says. “If that context is just specification or reference-level, you still get issues like wrong SDK usage, missing init patterns, or inferred workflows.”

Context Plugins bundle everything an agent needs to operate a tool, including SDKs, code snippets, documentation, and integration in a format the AI agent can understand. According to Ali, “Context Plugins focus on grounding the agent in implementation-ready context, versioned SDKs, typed schemas, real code paths, and workflows, so the model doesn’t have to infer how to use the API.” This eliminates the likelihood of an AI agent writing code based on outdated documentation or examples.

4. Arazzo

The Arazzo Specification is an API specification from the OpenAPI Initiative designed specifically to tell agents how to behave when interacting across multiple APIs. While regular API specifications describe what endpoints exist, Arazzo describes how to chain them together to achieve a particular result.

Using Arazzo can be a big step towards a deterministic API-based workflow, as the agent will combine the same endpoints every single time, resulting in more consistent results. Since AI agents themselves are beginning to author Arazzo workflows, it’s a low-effort, automated option for storing proven workflows.

5. MCP

While it might not be as granular as some of the other methods we’ve mentioned, you can’t talk about API context without mentioning Model Context Protocol (MCP). By acting as a consistent, uniform interface between an LLM and resources like databases or internal APIs, MCP helps establish a deterministic handshake, strictly defining what permissions and access are available to an agent. This predictability helps the AI be far more useful for production-ready results.

6. Code Mode

Code Mode goes one step further than MCP towards making an agentic ecosystem deterministic. MCP simply describes each tool and allows the agent to pick it up when it’s needed. This isn’t the most efficient way for agentic AI to invoke a tool, however. AI is great at writing code, which features strongly-typed, repetitive, predictable structure, which still leaves room for too much uncertainty.

Code Mode simply translates available tools into TypeScript APIs and then writes the code. Not only does this help prevent unpredictability in the tools themselves, it also limits how many times the LLM needs to call the tool to accomplish its task. This helps keep the distortion and miscommunication to a minimum.

Providing Agentic AI With Deterministic API Context

As agentic AI continues to become more popular and widespread, deterministic API context is only going to keep getting more important. Not only is allowing an AI to simply pick whatever tools it wants inefficient, it’s also unsafe and insecure.

Outdated APIs or tools might no longer adhere to the latest security best practices, for instance. It can also be bad for your reputation if you’re planning on releasing the product to the public. Outdated APIs might not perform as well as they could, delivering a slow, buggy experience for your users.

As much as it looks like AI are thinking, reasoning machines, they need to be told what to think. Introducing API context into an agentic system allows an AI agent to find the right tool for the job every time, as quickly and efficiently as possible.

AI Summary

This article explains how developers can provide deterministic API context to AI agents to improve reliability, consistency, and correctness when interacting with APIs.

  • Deterministic API context ensures AI agents produce consistent outputs given the same inputs, reducing reliance on probabilistic inference and outdated training data.
  • Agent skills and deterministic chains help constrain how tasks are executed, enforcing structured workflows and predictable tool usage.
  • Context plugins provide implementation-ready knowledge, including SDKs, schemas, and workflows, ensuring agents use APIs correctly without guessing.
  • The Arazzo Specification defines how API calls are sequenced, while Model Context Protocol (MCP) standardizes access and permissions between agents and APIs.
  • Code Mode further improves determinism by translating tools into strongly typed APIs and generating structured code, minimizing ambiguity in execution.

Intended for API architects, platform engineers, and AI developers designing agentic systems that rely on consistent, secure, and predictable API interactions.