AI Agent API: Definition, State and the API Layer (2026)
What an AI agent API is, how four vendors handle state, what an agent API layer needs, and how to keep durable agent state in an app you own on Major.

An AI agent API accepts a goal and runs the reasoning loop on the provider's infrastructure. The model reasons, calls tools, reads results, and repeats until it decides it is done, so you get back the outcome of several steps instead of the next chat message. The decision that matters most is state: what survives after the request returns, and who owns it.
Major is where that state should live. On Major, an agent works out a repeatable piece of work once, builds an app for it with a managed database, file storage and logs, and then runs the app instead of re-reasoning the work on every request. The model still handles judgment. The records and the repeatable steps sit in software your organization owns and can audit.
What is an AI agent API?
The phrase carries two opposite meanings, and the pages ranking for it rarely say so.
- An API that is an agent. You send a goal to a provider endpoint. The provider runs the loop, executes tools, and returns results. Mistral, Google, Perplexity and OpenAI ship this.
- The APIs an agent calls. The integration surface an agent reaches through to read records and act in other systems. MuleSoft and Composio write about this sense.
This article covers the first sense and then the second, because most production designs need both. Composio's January 2026 guide frames the second well: "APIs give your AI agent a way to perceive data from external systems and act on it." They describe opposite directions of a call, and mixing them up is how procurement conversations go sideways.
What is an agent API layer?
An agent API layer is the set of governed endpoints between your agents and your systems of record. The agent never talks to Salesforce, Postgres or an internal service directly. It calls the layer, and the layer enforces scope, logs the call and returns structured results.
Two designs exist. In the first, the layer is a bundle of tool definitions living in a prompt, and every run re-reasons which tool to call and how. In the second, the layer is deployed software: apps with typed endpoints, a database and an audit log, which the agent invokes. The second design is deterministic where it can be and uses the model only for judgment. That is the Major approach, and it is covered below.
What does an agent API add over chat completions?
Four things.
- Built-in tools. Perplexity's Agent API ships
web_search,fetch_urlandfinance_searchbehind one bearer-authenticated call toPOST https://api.perplexity.ai/v1/agent, with an OpenAI-compatible alias atPOST /v1/responses. Mistral describes built-in connectors for code execution, image generation, document library search and web search, plus MCP tools. - An execution environment. Google's managed agents provision an OS-isolated Linux workspace on one API request, where the agent runs programs, handles files and browses. Mistral runs Python in a sandbox for calculation and analysis.
- Orchestration and handoffs. Mistral's agents can be added to or removed from a conversation, with tasks delegated between specialized agents through configured handoffs.
- Persisted conversation, sometimes. This varies by vendor, and it decides whether your work is still reachable in month eight.
A chat completions endpoint stays the better fit for single-turn classification or extraction. It is cheaper, faster and easier to reason about than a full agent loop. The agent surface earns its place when the work genuinely branches. For the broader architecture around these choices, see AI agent architecture.
How do the major agent APIs handle state?
Ask four questions of any agent API. Who holds the conversation history. For how long. Can you query or export it. Would an auditor accept it as a record. Vendor documentation, as we read it on 27 August 2026, answers them unevenly.
- Mistral Agents API: server-side conversations. The announcement advertises "Persistent memory across conversations" and says "Each conversation retains its context." No retention window, expiry rule or export path is published, and a Conversations API appears in the docs marked beta.
- Gemini managed agents: no native conversation state. A hosted workspace holds files between calls, and environments are deleted after seven days of inactivity. For multi-turn and multi-agent state, Google's documentation points to LangChain, LangGraph and the ADK, so the memory problem stays yours.
- Perplexity Agent API: two response fields,
previous_response_idandstore, shown in the quickstart without prose definitions, a multi-turn example, or a retention policy. - OpenAI Responses API:
storecontrols retention,previous_response_idchains turns, and Conversation objects hold messages, tool calls and outputs. It is the only one of the four with a published number: "Response objects are saved for 30 days by default," per the conversation state guide.
"Stateful" in agent API marketing almost always means the vendor is holding your state. Your system has not become stateful. A conversation you cannot query on a field you care about, export on a schedule, or show an auditor with attribution is a context window on a longer lease. It works for a session. It is not a system of record. More on this in AI agent memory.
What about credentials and the execution environment?
The agent acts under some credential, and your security team will ask which one first. Google documents an interesting answer: credentials can be supplied through "egress proxy header transformations," so they are never exposed inside the workspace. The same page says outbound network access is unrestricted initially, with domain allowlisting available, and warns that any credential you supply may be usable by the agent. Together those facts mean a default configuration can reach anything on the public internet.
The baseline is scoped, short-lived tokens bound to specific operations, rotation, and a log of every call made under them. Enforcement belongs at the point of action, not in a policy document. See AI agent access control and AI agent security for the control model.
Execution environments differ in what they keep. A Linux workspace that pauses and resumes can hold artifacts across calls. A sandbox that expires leaves you with a result you did not keep. And Mistral's multi-agent topology lives in provider configuration rather than in code you version and review.
Build the stateful agent API layer on Major
Use whichever managed agent API suits the reasoning step, and put the durable work on Major.
- The app holds state. The agent builds a Major app for the repeatable part of the job, for example an intake and routing app. Its managed database stores records and history as queryable tables, with files in managed storage.
- The app is the API. The deployed app exposes typed endpoints, so the agent API layer is code you version and review, not a prompt that is re-interpreted on every run.
- The agent keeps the judgment. It decides edge cases, drafts ambiguous responses and escalates to a person. Everything that runs the same way each time moves into deterministic app code.
- Connectors reach your systems. Salesforce, Postgres, Slack, Gmail and an internal REST or GraphQL API attach as connectors. The agent calls them through the credential proxy and never holds the secret.
- A trigger runs it. A workflow fires on a schedule, a connector event or a webhook, calls the app, and invokes the agent only for the judgment step.
- Governance sits where the agent acts. Scoped credentials, role-based access and audit logging apply to every call, so you can reconstruct which tools were available, what ran, and under whose identity.
The effect on cost is structural. The first run spends tokens working out the procedure. Later runs call the app, so the model carries a smaller share of the load and cost flattens instead of climbing with every request. Start building free and try it on one workflow you currently re-prompt. For the full agent design, read building AI agents.
Common misconceptions
"Stateful" means your system is stateful. It usually means the provider stores something for an unspecified period under terms you did not negotiate.
An agent API removes the need for your own data model. It moves the loop and leaves the records with you. If the outcome matters next quarter, it belongs in a schema you designed.
A bigger context window substitutes for persistence. A context window is not queryable, not attributable and not durable. It is the working memory of one run.
An agent API removes the need for a framework. Google's own documentation recommends LangGraph and the ADK for stateful and multi-agent work.
What this does not cover
Agent evaluation is a separate and harder problem, and this piece does not address it. Major also does not remove the model. A workflow that fits in one prompt and runs twice a week does not need an app layer. The case for Major gets strong when the work repeats under stable rules, crosses several systems of record, and someone will eventually ask what the agent did in March.
Start building on Major
Put the state your agents produce into a governed app with its own database, endpoints and audit trail, then let the agent do the part that needs judgment. Build the first one in minutes, or walk through a stateful agent API design with our team.
Related articles
Frequently asked questions
- What is an AI agent API?
- An AI agent API is an interface that runs an agent loop on the provider's side: you send a goal, and the provider handles reasoning, tool calls and multi-step execution, returning an outcome rather than the next message. It differs from a chat completions endpoint, which returns one completion per prompt. Major takes the other path: an agent reasons once to produce a deployed app, and the repeatable part then runs as code.
- What is an agent API layer?
- An agent API layer is the set of governed endpoints between your agents and your systems of record. The agent calls the layer instead of each system directly, and the layer enforces scope, logs every call and returns structured results. On Major the layer is deployed apps with typed endpoints, a managed database and audit logs, so it runs as code rather than as a re-reasoned prompt.
- What is the difference between an AI agent API and a chat completions API?
- A completions API returns one response for one prompt, and any looping is your code's job. An agent API runs the loop on the provider's side, usually with built-in tools and an execution environment attached, and often with the conversation persisted server-side. Completions endpoints remain better for single-turn extraction or classification. On Major, the finished app serves the requests that used to be prompts.
- Are AI agent APIs stateful?
- Some are, and the state they keep belongs to the provider rather than to you. Mistral persists conversations server-side without publishing a retention policy. Google's managed agents hold no native conversation state. Perplexity exposes previous_response_id and store, and OpenAI saves response objects for 30 days by default. None of that is a record your systems can query or audit. On Major, state lives in a managed database inside the app.
- How do I give an AI agent access to my internal APIs?
- Use tool definitions, an MCP server, or an integration layer that fronts several systems. The mechanism matters less than the credential behind it. Give the agent a scoped, short-lived token bound to the specific operations it needs, rotate it, and log every call. Major runs this through a credential proxy, so the agent reaches the system without holding the secret and each action is recorded.
- Do I need an agent framework if I use an agent API?
- Not for a single-loop task with a clear finish line, since the managed surface already covers it. You need more once you have durable state across runs, branching control flow, or several agents coordinating. Google's documentation points to LangChain, LangGraph and the ADK for those cases. Major handles the durable part by letting the agent build an app that holds state and runs repeatable steps as code.