Architecture guide

AI agent API for product features

What a product needs when users expect completed work: sessions, streaming, files, artifacts, routing, and production controls.

Short answer

An AI agent API should represent a work lifecycle, not only a model response. Product teams need a task or session they can stream, observe, continue, and turn into reviewable artifacts.

  • Use a model API when the product needs inference or a conversational response.
  • Use an agent SDK when the team wants to operate the agent loop in its own infrastructure.
  • Use an agent backend when the product needs hosted runs, durable sessions, files, artifacts, routing, and a control plane.

Represent work, not just messages

Input
A product task, selected configured agent, files, authorized context, and execution policy.
Lifecycle
A durable task, run, or session with status, streaming events, retries, and continuation.
Output
Structured results, generated files, diffs, artifacts, and metadata the product UI can render.

Choose the layer that matches the product job

QuestionModel API or agent SDKAgent backend API
Who operates the loop?Your application and infrastructure.The hosted agent backend or harness layer.
What comes back?Messages, tool calls, or SDK events.A run with state, files, artifacts, and continuation.
Best fitCustom loops and infrastructure control.Shipping agent-backed product features without rebuilding the execution backend.

What to verify before choosing an AI agent API

  • Confirm how sessions persist and how a user continues or revises prior work.
  • Verify streaming semantics, idempotency, concurrency, cancellation, and retry behavior.
  • Check how files enter the run and how artifacts return to the product UI.
  • Keep enough execution evidence to explain harness choice, model choice, tool activity, latency, failure state, and cost where billing records expose it.
  • Keep harness-specific behavior behind a stable product contract.

FAQ

Is an AI agent API the same as an LLM API?
No. An LLM API returns model inference. An AI agent API can also manage tools, sessions, execution state, files, and artifacts produced across a longer-running task.
Is an AI agent API the same as an agent SDK?
No. An agent SDK usually runs inside infrastructure you operate. A hosted agent API can operate the run lifecycle and expose it to your product as a service.
When does a product need multiple agent harnesses?
When different tasks benefit from different agent environments, or when the team wants to change harnesses without rewriting its product integration and output handling.

Run your first agent task.

One API for agent tasks, sessions, streaming, files, and artifacts across Codex, Claude Code, and Hermes.

Start building free