Skip to content
Is there an AI for this?

Model API

Agent workflow on a model vendor’s API

LangGraph as the orchestration graph mixing deterministic and model-driven steps, a closed model (GPT-5, Claude or Gemini) for the reasoning, your own tools for the actions, Langfuse for tracing and evaluation, and human approval gates on the steps that change something.

Source
Editorial recipe — no step evidence has been fetched yet
Verified
Evidence not verified
Confidence
Low

01Objective


02Recommended stack

5 components
RoleComponent
AuthenticationIdentity provider (OIDC) for the application
InferenceClosed model API (OpenAI, Anthropic or Google Gemini)
IngestionTools (your APIs and systems)
ObservabilityLangfuse
OrchestrationLangGraph

Architecture and data flow

Architecture for Agent workflow on a model vendor’s API8 components in 5 layers. Trust boundaries: COMPANY NETWORK; VENDOR CLOUD · Model vendor cloud. External data transfer: YES. Data leaves the boundary drawn here.Users / triggering systemAgent application (LangGraph orchestrator)Tools + retrieval (your APIs and data)Agent state + Langfuse tracesCompany systems the agent acts on (CRM, ticketing, mailbox)Users / triggering systemUsers / triggering syst…PEOPLEAgent application (LangGraph orchestrator)Agent application (Lang…APPLICATIONIdentity provider (OIDC)IDENTITYTools + retrieval (your APIs and data)Tools + retrieval (your…RETRIEVALAgent state + Langfuse tracesAgent state + Langfuse …DATABASEVendor model APIINFERENCE SERVERCompany systems the agent acts on (CRM, ticketing, mailbox)Company systems the age…INTERNAL SYSTEMClosed frontier modelMODELCOMPANY NETWORKVENDOR CLOUD · Model vendor cloudHTTPSCONFIDENTIALOIDC sign-inPERSONALquestion + user groupsCONFIDENTIALdocuments + permissionsCONFIDENTIALchats, users, settingsPERSONALprompt + retrieved passagesCONFIDENTIALloaded weightstool actions (read and write)CONFIDENTIALEXTERNAL DATA TRANSFER · YES

Components

  • Users / triggering system — people
  • Agent application (LangGraph orchestrator) — application
  • Identity provider (OIDC) — identity
  • Tools + retrieval (your APIs and data) — retrieval
  • Agent state + Langfuse traces — database
  • Vendor model API — inference server
  • Company systems the agent acts on (CRM, ticketing, mailbox) — internal system
  • Closed frontier model — model

Connections

  • Users / triggering system to Agent application (LangGraph orchestrator) — HTTPS (confidential data)
  • Agent application (LangGraph orchestrator) to Identity provider (OIDC) — OIDC sign-in (personal data)
  • Agent application (LangGraph orchestrator) to Tools + retrieval (your APIs and data) — question + user groups (confidential data)
  • Tools + retrieval (your APIs and data) to Agent state + Langfuse traces — documents + permissions (confidential data)
  • Agent application (LangGraph orchestrator) to Agent state + Langfuse traces — chats, users, settings (personal data)
  • Tools + retrieval (your APIs and data) to Vendor model API — prompt + retrieved passages (confidential data)
  • Vendor model API to Closed frontier model — loaded weights
  • Tools + retrieval (your APIs and data) to Company systems the agent acts on (CRM, ticketing, mailbox) — tool actions (read and write) (confidential data)

External data transfer · YES

  • confidential content leaves your control on the Tools + retrieval (your APIs and data) → Vendor model API link.
  • The orchestration, the tools, the state and the traces stay on your network; only the model call crosses to the vendor. The agent sends the prompt and every tool result it reasons over with it — more than a single-shot assistant.
  • The actions land in systems you control; those writes are not a transfer out, but a person should approve the consequential ones.

03Suitable for

Organisation size
20–10000 employees
Data classes
confidential, personal
Constraints
a genuine multi-step task — planning, tool use, looping — not a single question; a team that can build and operate an application, or an implementation partner; agreement that prompts and tool inputs may leave the network to the model vendor
Industries
Technology, Professional services, Financial services, Recruitment hr, Other
Jurisdictions
any

04Hardware

No hardware profile was sized for this answer.

Indicative costUSD · one-off plus monthly

Software
LangGraph and Langfuse are open source and self-hosted. What you pay the model vendor is metered and sits on the model line.
US$0
Model usage
Not estimated here: priced per token — see the cost section, which multiplies a fetched price by the usage band read from your brief. An agent uses more tokens per task than a single answer, because it loops — the assumption band should reflect that.
Not estimated
Application hosting, state and trace store
Not estimated: the orchestrator, a state store and the Langfuse backend, priced per your own infrastructure. No price list was fetched.
Not estimated
Implementation (8–22 FDE-days)
8–22 FDE-days at US$760–1940 per day, converted from the HK$6,000–15,000 band at the HKMA Linked Exchange Rate band of HK$7.75–7.85 to one US dollar. One-off; excludes internal staff time.
US$6,080 – US$42,680
  • The model line is the metered one and is larger per task than a single-shot assistant because an agent loops; the cost section computes it from a fetched price and the usage band.
  • Implementation is dominated by designing and hardening the graph, the tools and the evaluation — the agent’s reliability is the work, not the wiring.
  • Assumes the systems the agent acts on already have APIs to call.

05Difficulty

4 / 5

Multiple weeks and a team that has shipped infrastructure


06Skills

API integrationapi-integration
development
LLM evaluationllm-evaluation
ml
Prompt engineeringprompt-engineering
ml
Security hardeningsecurity-hardening
security
TypeScripttypescript
development
Workflow automationworkflow-automation
operations

07Deployment steps

7 steps

Commands are copied from each project’s own documentation, and the page they came from is linked under the step. 0 of 7 steps currently open an evidence record. The rest are linked to their source; §10 says which of those documents were fetched and which were fetched without their anchor being found — two different states, named differently there.

  1. 01

    Design the graph before the promptsversion-sensitive

    Assessment

    LangGraph is "a low-level orchestration framework and runtime for building, managing, and deploying long-running, stateful agents". Its point is that you can "mix deterministic, hand-coded steps with LLM-driven agentic steps in the same graph" — so make the steps that must be reliable deterministic, and reserve the model for the parts that genuinely need judgement. Draw the graph first; the prompts come after.

    pip install -U langgraph

    Source documentation

  2. 02

    Connect the model, and read its data terms firstversion-sensitive

    Assessment

    The model does the planning and tool selection, so the vendor sees the prompt and the tool inputs. Before real data flows, confirm the commercial terms: Anthropic states that "by default, we will not use your inputs or outputs from our commercial products" to train, and OpenAI’s enterprise page describes commitments giving you "ownership and control over your business data". Record which plan and endpoint the wording applies to.

    Source documentation

  3. 03

    Define narrow tools and scope their permissions

    Assessment

    Each tool is a capability you hand the agent. Give each one the least access it needs, run it under the identity of the user who triggered the agent rather than a superuser service account, and validate its inputs in code — a model that can call a tool with any argument is a model that can call it with the wrong one. The orchestration graph is where these calls are wired.

    Source documentation

  4. 04

    Put a human gate on the consequential actions

    Assessment

    Not every step should run unattended. LangGraph lets you "incorporate human oversight by inspecting and modifying agent state at any point" — use it: pause before an action that spends money, emails a customer or changes a record, and require an approval. The cost of the gate is latency; the cost of not having it is an autonomous mistake.

    Source documentation

  5. 05

    Trace every run with Langfuse

    Assessment

    Langfuse is "an open-source AI engineering platform" whose "traces include all LLM and non-LLM calls, including retrieval, embedding, API calls, and more", and where "LLM agents can be visualized as a graph to illustrate the flow of complex agentic workflows". Wire it in from the first prototype: without the trace, an agent that did the wrong thing is a black box, and the trace is also the audit record.

    Source documentation

  6. 06

    Evaluate on real tasks, and cap the loop

    Assessment

    Build a set of real tasks with agreed outcomes and run them through Langfuse’s evaluation before launch and after every prompt or model change — an agent’s failure modes are compounding, not one-shot. Cap the number of steps and the spend per run so a reasoning loop that goes wrong stops rather than bills, and alert on runs that hit the cap.

    Source documentation

  7. 07

    Verify the vendor’s data-handling before productionversion-sensitive

    Assessment

    For the model endpoint you will call, confirm the DPA covers the API, whether a zero-data-retention mode is available, the retention period and what triggers human review, and the region the request is served from. The agent sends more to the vendor than a single-shot assistant does — every tool result it reasons over — so the data question is larger here, not smaller.

    Source documentation


08Compliance considerations

Structured issue-spotting to support your own review — not legal advice. Verify against the cited primary sources and your counsel.

Applies everywhere

  • Human oversight · Automated decision-makinghigh

    An agent takes actions, not just answers. Put a human approval gate on any step that changes something or affects a person — LangGraph supports pausing to inspect and modify state — and keep the trace of what was approved and by whom.

  • Prompt leakage · Confidentialityhigh

    The vendor sees every prompt and every tool result the model reasons over — more than a single-shot assistant sends. Decide which tools may return confidential data into the model context, and keep anything under a duty of confidence out of the tools the agent can reach.

  • Data processing agreement · Model training · Retentionhigh

    You need a DPA covering the API and the no-training default for the plan you buy. Anthropic states it does not use commercial inputs or outputs to train by default; confirm the equivalent for your vendor and whether zero data retention is available on your account.

  • Logging · Auditabilitymedium

    The Langfuse trace is the audit record of what the agent did: which tools, which arguments, which model outputs. Keep it under the same retention and access rules as the systems the agent acts on, because it can contain their data.


09Alternatives


10Evidence

0 of 8 fetched

11Community

Deployed this stack, or hit something this page does not cover? Corrections, sources and implementation reports are what keep a recipe worth reading.

Improve this page

Sign in to contribute

From the field

0 deployments · 0 questions

Nobody has reported deploying this here yet, and no question has been opened against this page. Both appear once a reviewer accepts them.


12Hire an FDE

If you would rather not build it, we can introduce a forward-deployed engineer who has deployed this stack before. The enquiry form starts from this recipe.