An agent SDK is a model vendor's kit for building agents: the loop that lets a model call tools, plus approvals, sessions and tracing. OpenAI ships the OpenAI Agents SDK, Google ships the Agent Development Kit (ADK), and Anthropic ships the Claude Agent SDK.
They look like the frameworks in Agent frameworks compared, such as LangGraph and Pydantic AI, and they do overlap. The difference is who stands behind them. A vendor SDK is shaped around its maker's models, its maker's tracing and its maker's hosting. A framework is shaped around the agent's structure and tries to stay neutral about the model.
For SAP work the choice narrows quickly. SAP's own pages name some of these tools for pro-code agents and not others. Joule reaches a pro-code agent over an open protocol, so any SDK can be connected if it speaks that protocol. And the parts that decide whether the agent is safe (which tools exist, who approves a change, what reaches SAP) stay your code whichever SDK you pick.
So the decision is less "which SDK is best" and more "which vendor's defaults are we willing to live with".
Take Calder Pumpworks, the fictional pump maker used across this course. Its customer service team wants an agent that looks at a blocked sales order and, for a credit block, drafts a credit release request for the credit analyst. A person approves before anything is drafted. The agent never releases the order itself.
That agent can be written in any of the three SDKs in a day. What differs is what comes with it:
Where your data goes by default. The OpenAI Agents SDK uploads traces to OpenAI's servers unless you turn that off or send them elsewhere. Traces can hold order values and customer names. Someone must decide that on purpose.
What you install and run. In our test on 14 November 2026, the OpenAI Agents SDK brought 38 Python packages (about 71 MB), Google ADK 48 packages (about 85 MB) and the Claude Agent SDK 30 packages but about 395 MB, because it ships the Claude Code program it runs. Every package is something your security team scans.
Which model you're tied to. All three can be pointed at other models in some way, but each works best with its maker's. If your company buys models through SAP's generative AI hub, check how the SDK reaches them before you commit.
Whether a pause survives. An approval may wait hours. ADK's own documentation says its tool confirmation doesn't work with its database session store. That matters more than any feature list.
Contract terms. The Claude Agent SDK is governed by Anthropic's Commercial Terms of Service. The other two are open-source libraries, and the model calls they make fall under each vendor's own terms.
None of these is a reason to rule an SDK out. Each is a question with an owner.
Joule Studio. Agents built in Joule Studio, in the browser or in your own development tool with the Joule Studio CLI and a coding agent, deploy to an SAP-managed runtime.
Pro-code in your own subaccount. You write the agent with the SAP Cloud SDK for AI and an agent framework, and run it as a self-managed runtime. The page names LangGraph, AG2, CrewAI, Smolagents, Google ADK and Pydantic AI.
SAP's May 2026 announcement of the new Joule Studio says its pro-code capabilities "support frameworks such as LangChain, Pydantic AI, and LlamaIndex" (SAP News, 13 May 2026). The two lists differ, so read both as examples, not a closed set.
Of the three vendor SDKs, only Google ADK appears on SAP's lists. The OpenAI Agents SDK and the Claude Agent SDK are not named on the SAP pages read for this topic. That doesn't block them: SAP's page on connecting agents to Joule covers agents built with "any framework that supports A2A", the open Agent2Agent protocol, and gives its version as 0.3.0 (Integrating AI Agents with Joule, 26 October 2026). It does mean the integration and the support story are yours.
Both Architecture Center pages carry a disclaimer that some components are not yet generally available, and the Agentic AI page says two-way communication with self-hosted agents through the Agent Gateway is not yet supported.
Pro-code agent, and you want to stay on SAP's named list
Google ADK, LangGraph or Pydantic AI
Named by SAP; ADK also documents serving an agent over A2A
Your company already standardized on OpenAI models and tooling
OpenAI Agents SDK
Small set of ideas, good approval support; you own the Joule connection and must decide where traces go
The agent works on files and commands, like a coding or operations agent
Claude Agent SDK
It brings Claude Code's file, shell and web tools and permission system; most of that is unused for a pure SAP API agent
You can't yet say what the agent decides, in one sentence
None yet
Write the decision down first; the SDK can wait
The safest habit: keep your tools, rules and data access in plain functions that no SDK owns. The hands-on in the deep layer does exactly that, which is why the same agent ports between two SDKs in an afternoon.
"A vendor SDK only works with that vendor's models." All three document some way to use other models, but with caveats. The OpenAI Agents SDK calls its LiteLLM and Any-LLM adapters best-effort and beta.
"If SAP doesn't name it, we can't connect it to Joule." Joule calls pro-code agents over A2A. Any agent that serves A2A can be connected; the named list tells you what SAP's own architecture work covers.
"The SDK's approval feature is our authorization check." It pauses and asks. It doesn't know who is allowed to answer, and the OpenAI documentation adds that approval "does not guarantee exactly-once execution".
"Picking the SDK is the big decision." In our test, the SDK-specific code was a small share of the agent. Tools, rules, data access and approvals were the rest, and they moved between SDKs unchanged.
"The Claude Agent SDK is a thin API wrapper." It runs the Claude Code program as a library, with its tools and settings. That is powerful for some jobs and heavy for others.
Pick one answer for each question. The explanation appears after you choose.
1What mainly separates a vendor agent SDK from a framework like LangGraph?
Answer: D. Both kinds supply the tool loop and often approvals and sessions. The difference is the defaults: a vendor SDK leans towards its maker's models, tracing and hosting, while a framework tries to stay neutral about the model.
2Which of the three vendor SDKs is named on SAP's Architecture Center list of pro-code agent frameworks, as of October 2026?
Answer: D. The Agentic AI reference architecture names LangGraph, AG2, CrewAI, Smolagents, Google ADK and Pydantic AI. The other two SDKs are not on the SAP pages read for this topic, though they can still reach Joule over A2A.
3Your team picks the OpenAI Agents SDK for an agent that reads Calder sales orders. Which default should someone decide on before go-live?
Answer: B. The SDK's documentation says traces go to OpenAI's servers unless tracing is disabled or sent to another processor. Traces can hold order values and customer names, so this is a data decision with an owner.
4An approval may wait overnight. What should you check in the SDK before relying on its approval feature?
Answer: A. A pause that outlives the process needs its state saved outside it. ADK, for example, documents that its tool confirmation doesn't work with its database session store, which matters more than any feature list.
5Joule must call a pro-code agent your team built with an SDK that SAP doesn't name. What makes that possible?
Answer: C. SAP's page on connecting agents to Joule covers agents built with any framework that supports A2A, with Joule acting as the A2A client. The named list shows what SAP's architecture work covers, not what can connect.
6Why does the hands-on keep tools, rules and data access in plain functions that no SDK owns?
Answer: B. The parts that decide whether the agent is safe and correct are the tools, rules and approvals. Keeping them outside the SDK limits lock-in to the thin layer that wires them up.
Every agent has the same core: a model, some tools, and a loop that passes tool results back to the model. Around that core sits the harness. Agent frameworks compared split the harness into jobs. For choosing among vendor SDKs, a coarser view works better. The harness has three seats, and the question is who sits in each:
The loop seat. Who runs the model-tool-model cycle, and in which process? Your Python process (OpenAI Agents SDK, ADK), or a separate program your process drives (the Claude Agent SDK runs the Claude Code binary).
The pause seat. When a tool needs approval, who holds the paused run, and where? An object you serialize (OpenAI's RunState), a session store with an event you answer (ADK), or a callback that blocks inside the run (the Claude Agent SDK's can_use_tool).
The record seat. Where do traces, sessions and memory go by default? Local memory, your database, or the vendor's cloud.
Your code keeps the fourth seat in all three: the tools and the rules. That one decides whether the agent is safe. Keep it portable and the SDK choice becomes a reversible decision about the other three.
The agent in this topic is small on purpose. It reads a Calder sales order and, for a credit block, asks to draft a credit release request. The draft tool is gated: a person must approve before it runs. Here is where each SDK puts the pause.
sequenceDiagram
participant U as Your app
participant H as SDK harness
participant M as Model
participant T as Your tools
U->>H: "Order 1000002 is stuck"
H->>M: instructions + tool list
M-->>H: call get_sales_order
H->>T: get_sales_order(1000002)
T-->>H: credit block, 24,288.00 USD
H->>M: tool result
M-->>H: call request_credit_release
H-->>U: pause: approval needed
U->>H: approve or reject
H->>T: request_credit_release (only if approved)
H->>M: tool result or rejection
M-->>U: final answer
The diagram is the same for all three. What differs is how "pause" and "approve" look in code:
OpenAI Agents SDK
Google ADK
Claude Agent SDK
Mark a tool as gated
@function_tool(needs_approval=True) or an async function that decides per call
FunctionTool(fn, require_confirmation=True) or a function that decides per call
Leave it out of allowed_tools; can_use_tool is then asked
How the pause shows
The run returns with result.interruptions
The run emits a function call named adk_request_confirmation
Your can_use_tool callback is called and the run waits for its answer
How you answer
state = result.to_state(), state.approve(item) or state.reject(item), then Runner.run(agent, state)
Send a function response named adk_request_confirmation with confirmed true or false, same session
Return PermissionResultAllow or PermissionResultDeny
Can the pause outlive the process?
Yes: RunState serializes to JSON; load it only from trusted storage
Depends on the session store; the docs list two stores that don't support confirmation
Not by this mechanism: the callback runs inside the live session
OpenAI Agents SDK. A Python library with a small set of ideas, described in Agent frameworks compared. It calls OpenAI's Responses API by default. Other providers work through an OpenAI-compatible client or through LiteLLM and Any-LLM adapters, which its models page calls best-effort and beta. Tracing is on by default and uploads to OpenAI; set_tracing_disabled(True) turns it off. Version 0.24.0 was current on PyPI when this was written, so expect breaking changes between minor versions.
Google ADK. A larger kit, offered in several languages, with session services, a runner, a web UI and an API server. It reaches Gemini by model name, and other models through connectors such as LiteLLM. It documents serving an agent over A2A with to_a2a(), which generates an agent card (ADK A2A quickstart). Version 2.14.1 was current on PyPI in this run.
Claude Agent SDK. In Anthropic's words, the same tools, agent loop and context management that power Claude Code, programmable in Python and TypeScript; technically "a library that runs the Claude Code binary" (overview). You get file, shell and web tools, hooks, subagents, MCP and a permission system. Your own tools are added as an in-process MCP server. It needs an API key: the overview says third-party products may not use claude.ai login without approval. Version 0.2.182 was current on PyPI in this run.
#Build it yourself: one agent, two SDKs, then a third
You will build the Calder order-exception agent in the OpenAI Agents SDK and in Google ADK, from one file. The data, tools and rules are shared, and a scripted stand-in plays the model, so both runs are free, need no account, and must give identical results. Then, if you have a Claude API key, you run the same agent in the Claude Agent SDK.
Before you start: complete Set up your computer for this course and Set up for Unit 9, which create the orchestrate-course folder, the .venv virtual environment and the unit09 subfolder. This walkthrough doesn't repeat those steps.
flowchart LR
S[Shared part<br/>orders, tools, rules] --> A[OpenAI Agents SDK]
S --> B[Google ADK]
S --> C[Claude Agent SDK<br/>optional, needs a key]
A --> R[Same answer?<br/>Same pause?]
B --> R
Both SDKs pull in the mcp package. Set up for Unit 9 already installed version 2 of it, and pip check should still print No broken requirements found. In our run it did, with the LangGraph and Pydantic AI lines from Agent frameworks compared installed in the same environment.
Create unit09/sdk_twice.py and paste this in. It is long because it holds both routes and the scripted model; the table after Step 6 explains each part.
"""One Calder order-exception agent, built twice: OpenAI Agents SDK and Google ADK.
Run without any account (scripted model):
python unit09/sdk_twice.py --sdk both --order 1000002 --decision approve
The agent reads a blocked sales order and, for a credit block, asks to draft a
credit release request. Drafting needs a person's approval in both SDKs.
Nothing is ever written to SAP: the "draft" is a line in a local file.
All orders, numbers and names are fictional course values.
"""
import argparse
import asyncio
import json
import os
import re
import warnings
from pathlib import Path
warnings.filterwarnings("ignore") # keep the output readable; SDK warnings are not errors here
# ---------------------------------------------------------------------------
# Shared part 1: the stand-in SAP data and the two tools (the same for both SDKs)
# ---------------------------------------------------------------------------
ORDERS = {
"1000002": {"SalesOrder": "1000002", "CustomerName": "Hallam Fluid Systems",
"TotalNetAmount": "24288.00", "Problem": "credit block", "Owner": "Credit analyst"},
"1000003": {"SalesOrder": "1000003", "CustomerName": "Brennock Water Utility",
"TotalNetAmount": "12300.00", "Problem": "billing data incomplete",
"Owner": "Sales order team"},
"1000006": {"SalesOrder": "1000006", "CustomerName": "Brennock Water Utility",
"TotalNetAmount": "4200.00", "Problem": "billing block", "Owner": "Billing clerk"},
}
DRAFTS = Path(__file__).with_name("credit_release_drafts.jsonl")
INSTRUCTIONS = (
"You handle blocked Calder sales orders. Always read the order first with "
"get_sales_order. Only for a credit block, call request_credit_release once "
"with a one-sentence reason. For any other problem, name the owner and stop. "
"Never claim that an order was released: you can only draft a request."
)
def need_env(name: str) -> str:
"""For --llm: the model name comes from .env, so this script never guesses one."""
value = os.getenv(name)
if not value:
raise SystemExit(f"--llm needs {name} in your .env file (a model name your account can use).")
return value
def read_order(order_id: str) -> dict:
order = ORDERS.get(order_id)
return order if order else {"error": f"order {order_id} not found"}
def draft_release(order_id: str, reason: str, sdk: str) -> dict:
draft = {"draft": f"CRR-{order_id}", "order": order_id, "reason": reason,
"status": "waiting for the credit analyst", "changed_in_sap": False, "sdk": sdk}
with DRAFTS.open("a", encoding="utf-8") as f:
f.write(json.dumps(draft) + "\n")
return draft
# ---------------------------------------------------------------------------
# Shared part 2: the scripted "model" used when you run without --llm.
# It sees the conversation as plain events and decides the next step, so both
# SDKs get exactly the same behaviour and the comparison is fair.
# ---------------------------------------------------------------------------
def scripted_next_step(user_text: str, results: dict) -> tuple:
"""results maps tool name -> result text. Returns ("call", name, args) or ("text", s)."""
match = re.search(r"\b\d{7}\b", user_text)
order_id = match.group(0) if match else ""
if "get_sales_order" not in results:
return ("call", "get_sales_order", {"order_id": order_id})
order = json.loads(results["get_sales_order"])
if "error" in order:
return ("text", f"I could not find order {order_id}. Nothing was drafted.")
if order["Problem"] != "credit block":
return ("text", f"Order {order_id} has '{order['Problem']}'. "
f"Owner: {order['Owner']}. No action by the agent.")
if "request_credit_release" not in results:
reason = (f"{order['CustomerName']} order {order_id} for "
f"{order['TotalNetAmount']} USD is on credit block.")
return ("call", "request_credit_release", {"order_id": order_id, "reason": reason})
outcome = results["request_credit_release"]
if "CRR-" in outcome:
return ("text", f"Drafted CRR-{order_id}. It waits for the credit analyst; "
"the order is still blocked in SAP.")
return ("text", f"The reviewer did not approve a draft for order {order_id}. "
"Nothing was drafted.")
# ---------------------------------------------------------------------------
# Route A: OpenAI Agents SDK
# ---------------------------------------------------------------------------
async def run_openai(order_id: str, decision: str, use_llm: bool) -> dict:
from agents import Agent, Runner, function_tool, set_tracing_disabled
set_tracing_disabled(True) # no trace upload to OpenAI from this script
@function_tool
def get_sales_order(order_id: str) -> str:
"""Read one Calder sales order by its 7-digit number."""
return json.dumps(read_order(order_id))
@function_tool(needs_approval=True)
def request_credit_release(order_id: str, reason: str) -> str:
"""Draft a credit release request for the credit analyst. Changes nothing in SAP."""
return json.dumps(draft_release(order_id, reason, "openai-agents"))
model = need_env("OPENAI_MODEL") if use_llm else ScriptedOpenAIModel()
agent = Agent(name="order_exceptions", instructions=INSTRUCTIONS,
tools=[get_sales_order, request_credit_release], model=model)
prompt = f"Sales order {order_id} is stuck. What should happen?"
result = await Runner.run(agent, prompt, max_turns=6)
paused = False
while result.interruptions: # the run stopped and waits for a person
paused = True
state = result.to_state()
for item in result.interruptions:
print(f" [openai-agents] approval needed: {item.tool_name} {item.arguments}")
if decision == "approve":
state.approve(item)
else:
state.reject(item, rejection_message="Reviewer rejected the draft.")
result = await Runner.run(agent, state, max_turns=6)
calls = [i.raw_item.name for i in result.new_items if i.type == "tool_call_item"]
return {"answer": result.final_output, "paused": paused, "tool_calls": calls}
def ScriptedOpenAIModel():
"""A stand-in for a real model, in the shape the OpenAI Agents SDK expects."""
from agents.items import ModelResponse
from agents.models.interface import Model
from agents.usage import Usage
from openai.types.responses import (ResponseFunctionToolCall, ResponseOutputMessage,
ResponseOutputText)
class _Model(Model):
async def get_response(self, system_instructions, input, model_settings, tools,
output_schema, handoffs, tracing, **kwargs):
items = [input] if isinstance(input, str) else input
user_text, names, results = "", {}, {}
for raw in items:
it = raw if isinstance(raw, dict) else raw.model_dump()
if it.get("role") == "user":
content = it.get("content")
user_text = content if isinstance(content, str) else json.dumps(content)
elif it.get("type") == "function_call":
names[it["call_id"]] = it["name"]
elif it.get("type") == "function_call_output":
results[names.get(it["call_id"], "?")] = str(it.get("output"))
if isinstance(input, str):
user_text = input
step = scripted_next_step(user_text, results)
n = len(results) + 1
if step[0] == "call":
out = ResponseFunctionToolCall(type="function_call", name=step[1],
arguments=json.dumps(step[2]),
call_id=f"call_{n}", id=f"fc_{n}",
status="completed")
else:
out = ResponseOutputMessage(
id=f"msg_{n}", type="message", role="assistant", status="completed",
content=[ResponseOutputText(type="output_text", text=step[1],
annotations=[])])
return ModelResponse(output=[out], usage=Usage(requests=1), response_id=None)
async def stream_response(self, *args, **kwargs):
raise RuntimeError("This script does not stream.")
yield # pragma: no cover
return _Model()
# ---------------------------------------------------------------------------
# Route B: Google Agent Development Kit (ADK)
# ---------------------------------------------------------------------------
async def run_adk(order_id: str, decision: str, use_llm: bool) -> dict:
from google.adk.agents import LlmAgent
from google.adk.runners import InMemoryRunner
from google.adk.tools import FunctionTool
from google.genai import types
def get_sales_order(order_id: str) -> dict:
"""Read one Calder sales order by its 7-digit number."""
return read_order(order_id)
def request_credit_release(order_id: str, reason: str) -> dict:
"""Draft a credit release request for the credit analyst. Changes nothing in SAP."""
return draft_release(order_id, reason, "google-adk")
model = need_env("ADK_MODEL") if use_llm else ScriptedAdkModel()
agent = LlmAgent(name="order_exceptions", instruction=INSTRUCTIONS, model=model,
tools=[get_sales_order,
FunctionTool(request_credit_release, require_confirmation=True)])
runner = InMemoryRunner(agent=agent, app_name="calder")
session = await runner.session_service.create_session(app_name="calder", user_id="00100265")
prompt = f"Sales order {order_id} is stuck. What should happen?"
message = types.Content(role="user", parts=[types.Part(text=prompt)])
answer, paused, calls = "", False, []
for _ in range(3): # at most one approval round trip is expected
pending = None
async for event in runner.run_async(user_id="00100265", session_id=session.id,
new_message=message):
for call in event.get_function_calls():
if call.name == "adk_request_confirmation":
pending = call # the run waits for a person
else:
calls.append(call.name)
if event.is_final_response() and event.content and event.content.parts:
text = "".join(p.text or "" for p in event.content.parts)
answer = text or answer
if not pending:
break
paused = True
original = pending.args.get("originalFunctionCall", {})
print(f" [google-adk] approval needed: {original.get('name')} {original.get('args')}")
message = types.Content(role="user", parts=[types.Part(
function_response=types.FunctionResponse(
id=pending.id, name="adk_request_confirmation",
response={"confirmed": decision == "approve"}))])
return {"answer": answer, "paused": paused, "tool_calls": calls}
def ScriptedAdkModel():
"""The same stand-in, in the shape Google ADK expects."""
from google.adk.models.base_llm import BaseLlm
from google.adk.models.llm_response import LlmResponse
from google.genai import types
class _Model(BaseLlm):
model: str = "scripted"
async def generate_content_async(self, llm_request, stream=False):
user_text, results = "", {}
for content in llm_request.contents:
for part in content.parts or []:
if part.text and content.role == "user" and not user_text:
user_text = part.text
if part.function_response and part.function_response.name in (
"get_sales_order", "request_credit_release"):
results[part.function_response.name] = json.dumps(
part.function_response.response)
step = scripted_next_step(user_text, results)
if step[0] == "call":
part = types.Part(function_call=types.FunctionCall(name=step[1], args=step[2]))
else:
part = types.Part(text=step[1])
usage = types.GenerateContentResponseUsageMetadata( # a script uses no tokens
prompt_token_count=0, candidates_token_count=0, total_token_count=0)
yield LlmResponse(content=types.Content(role="model", parts=[part]),
usage_metadata=usage)
return _Model()
# ---------------------------------------------------------------------------
# Run one or both routes and print a small comparison
# ---------------------------------------------------------------------------
async def main() -> None:
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
parser.add_argument("--sdk", choices=["openai", "adk", "both"], default="both")
parser.add_argument("--order", default="1000002", help="1000002, 1000003 or 1000006")
parser.add_argument("--decision", choices=["approve", "reject"], default="reject",
help="what the reviewer answers when approval is needed (default: reject)")
parser.add_argument("--llm", action="store_true",
help="use a real model instead of the scripted one (needs a key)")
args = parser.parse_args()
if args.llm:
from dotenv import load_dotenv
load_dotenv()
routes = {"openai": ("openai-agents", run_openai), "adk": ("google-adk", run_adk)}
chosen = ["openai", "adk"] if args.sdk == "both" else [args.sdk]
rows = []
for key in chosen:
label, func = routes[key]
print(f"\n== {label} | order {args.order} | reviewer says {args.decision} ==")
out = await func(args.order, args.decision, args.llm)
print(f" tools asked for: {', '.join(out['tool_calls']) or 'none'}")
print(f" paused for approval: {'yes' if out['paused'] else 'no'}")
print(f" answer: {out['answer']}")
rows.append((label, out))
if len(rows) == 2:
same = rows[0][1]["tool_calls"] == rows[1][1]["tool_calls"] and \
rows[0][1]["paused"] == rows[1][1]["paused"]
print(f"\nSame tool calls and same approval behaviour in both SDKs: {'yes' if same else 'NO'}")
drafts = DRAFTS.read_text(encoding="utf-8").count("\n") if DRAFTS.exists() else 0
print(f"Drafts in {DRAFTS.name}: {drafts} (nothing was written to SAP)")
if __name__ == "__main__":
asyncio.run(main())
The reviewer's answer defaults to reject, so a run without --decision can never draft anything. That is the safe default for any approval.
python unit09/sdk_twice.py
What success looks like:
== openai-agents | order 1000002 | reviewer says reject ==
[openai-agents] approval needed: request_credit_release {"order_id": "1000002", "reason": "Hallam Fluid Systems order 1000002 for 24288.00 USD is on credit block."}
tools asked for: get_sales_order, request_credit_release
paused for approval: yes
answer: The reviewer did not approve a draft for order 1000002. Nothing was drafted.
== google-adk | order 1000002 | reviewer says reject ==
[google-adk] approval needed: request_credit_release {'order_id': '1000002', 'reason': 'Hallam Fluid Systems order 1000002 for 24288.00 USD is on credit block.'}
tools asked for: get_sales_order, request_credit_release
paused for approval: yes
answer: The reviewer did not approve a draft for order 1000002. Nothing was drafted.
Same tool calls and same approval behaviour in both SDKs: yes
Drafts in credit_release_drafts.jsonl: 0 (nothing was written to SAP)
Both SDKs stopped before the draft tool ran. "Tools asked for" lists what the model requested, including the request the reviewer turned down. The two lines starting approval needed print arguments differently (JSON text in one, a Python dictionary in the other): that is the SDKs' own formats showing through.
answer: Drafted CRR-1000002. It waits for the credit analyst; the order is still blocked in SAP.
Same tool calls and same approval behaviour in both SDKs: yes
Drafts in credit_release_drafts.jsonl: 2 (nothing was written to SAP)
Open unit09/credit_release_drafts.jsonl. It has two lines, one per SDK, each with "changed_in_sap": false. The count grows each time you approve; delete the file to start again.
What success looks like: for 1000003 both SDKs read the order, don't pause, and answer Order 1000003 has 'billing data incomplete'. Owner: Sales order team. No action by the agent. For 1000009, which doesn't exist, ADK answers I could not find order 1000009. Nothing was drafted. A run with no pause and no draft is a valid result: the agent's job is to route most orders, not act on them.
The shared stand-in for SAP: three fictional orders from the MCP gateway topic, and a draft that is only a line in a local file
INSTRUCTIONS
The rules the model is given; the same text goes to both SDKs
scripted_next_step
The shared scripted model: read the order first, draft only for a credit block, otherwise name the owner
run_openai
Wraps the two functions as tools with @function_tool, gates the draft with needs_approval=True, runs, and answers result.interruptions through RunState
ScriptedOpenAIModel
Translates the scripted model into the OpenAI SDK's Model interface: reads function calls and outputs, returns a function call or a message
set_tracing_disabled(True)
Stops the OpenAI SDK from uploading traces to OpenAI from this script
run_adk
Passes the read function as a plain tool, wraps the draft in FunctionTool(..., require_confirmation=True), watches for adk_request_confirmation and answers it with a function response
ScriptedAdkModel
The same scripted model, as an ADK BaseLlm subclass returning LlmResponse objects
--decision, --llm, --order, --sdk
Options: the reviewer's answer (default reject), a real model instead of the script, which order, which SDK
Count the lines yourself: the shared part is about a third of the file, and it holds everything that decides what the agent may do. Each route's agent code is 35 to 50 lines; most of the rest is the scripted model's adapters, which a real deployment doesn't need.
#Step 7 (optional): Point the routes at a real model
This step costs a few cents and needs an API key. Skip it if you don't have one; Steps 1 to 6 already showed the harness behaviour.
Open .env in the course folder and add the lines for the SDK you want to try. For the OpenAI route, a key from your OpenAI account and a model name your account can use:
What success looks like: the same shape as Step 4, with the model's own wording in reason and answer. A real model may phrase the reason differently, call the read tool twice, or skip the draft; that variation is what agent trajectory evaluation measures. The approval pause must still appear for order 1000002: the harness enforces it, not the model.
#Step 8 (optional): The same agent in the Claude Agent SDK
The Claude Agent SDK has no scripted-model path: it runs the Claude Code program, which calls Anthropic's API. So this step needs a key, and the install is large.
Add this line to requirements.txt and install again:
claude-agent-sdk==0.2.182
pip install -r requirements.txt
Add an API key from your Anthropic account to .env:
ANTHROPIC_API_KEY=paste-your-key-here
Create unit09/claude_route.py. It imports the shared part from sdk_twice.py, so the tools and rules are the same ones:
"""The same Calder order-exception agent in the Claude Agent SDK (needs ANTHROPIC_API_KEY).
python unit09/claude_route.py --order 1000002 --decision approve
There is no scripted-model path here: this SDK runs the Claude Code binary it
ships with, and that binary talks to Anthropic's API. Without a key the script
says LATER and stops. Tools and data come from sdk_twice.py, so the agent is
the same one.
"""
import argparse
import asyncio
import json
import os
import sys
from sdk_twice import INSTRUCTIONS, draft_release, read_order
async def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--order", default="1000002")
parser.add_argument("--decision", choices=["approve", "reject"], default="reject")
args = parser.parse_args()
from dotenv import load_dotenv
load_dotenv()
if not os.getenv("ANTHROPIC_API_KEY"):
print("LATER ANTHROPIC_API_KEY is not set: this route needs a Claude API key.")
sys.exit(0)
from claude_agent_sdk import (AssistantMessage, ClaudeAgentOptions, ClaudeSDKClient,
ResultMessage, TextBlock, ToolUseBlock,
create_sdk_mcp_server, tool)
from claude_agent_sdk.types import PermissionResultAllow, PermissionResultDeny
@tool("get_sales_order", "Read one Calder sales order by its 7-digit number.",
{"order_id": str})
async def get_sales_order(a):
return {"content": [{"type": "text", "text": json.dumps(read_order(a["order_id"]))}]}
@tool("request_credit_release",
"Draft a credit release request for the credit analyst. Changes nothing in SAP.",
{"order_id": str, "reason": str})
async def request_credit_release(a):
draft = draft_release(a["order_id"], a["reason"], "claude-agent-sdk")
return {"content": [{"type": "text", "text": json.dumps(draft)}]}
calder = create_sdk_mcp_server(name="calder", version="1.0.0",
tools=[get_sales_order, request_credit_release])
async def reviewer(tool_name, tool_input, context):
# Runs only for tools that are not auto-approved below: here, the draft.
print(f" [claude-agent-sdk] approval needed: {tool_name} {tool_input}")
if args.decision == "approve":
return PermissionResultAllow(updated_input=tool_input)
return PermissionResultDeny(message="Reviewer rejected the draft.")
options = ClaudeAgentOptions(
system_prompt=INSTRUCTIONS,
tools=[], # no built-in tools: no files, no shell, no web
setting_sources=[], # ignore any .claude settings on this computer
mcp_servers={"calder": calder},
allowed_tools=["mcp__calder__get_sales_order"], # reading needs no approval
can_use_tool=reviewer, # everything else asks the reviewer
max_turns=6,
)
calls = []
async with ClaudeSDKClient(options=options) as client:
await client.query(f"Sales order {args.order} is stuck. What should happen?")
async for message in client.receive_response():
if isinstance(message, AssistantMessage):
for block in message.content:
if isinstance(block, ToolUseBlock):
calls.append(block.name)
elif isinstance(block, TextBlock):
print(f" answer: {block.text}")
elif isinstance(message, ResultMessage):
print(f" tools asked for: {', '.join(calls) or 'none'}")
print(f" cost reported by the SDK: {message.total_cost_usd} USD")
if __name__ == "__main__":
asyncio.run(main())
Run it:
python unit09/claude_route.py --decision approve
What success looks like: a line [claude-agent-sdk] approval needed: mcp__calder__request_credit_release {...}, the model's answer, tools asked for: mcp__calder__get_sales_order, mcp__calder__request_credit_release, and the run's cost in USD. Without a key you see LATER ANTHROPIC_API_KEY is not set and nothing else happens. We could not run this step with a key in this run; the code follows the Python reference and imports cleanly with version 0.2.182.
Three lines in ClaudeAgentOptions matter more than the rest. tools=[] removes Claude Code's built-in file, shell and web tools, which this agent must not have. setting_sources=[] stops the SDK from loading .claude settings from your computer, which can include hooks. And allowed_tools auto-approves only the read tool; the reference warns that allowed_tools approves without restricting, so a gated tool must stay out of it.
SAP's Agentic AI and AI Agents reference architecture (updated 26 October 2026) describes two ways to build agents for the SAP Business AI Platform. In Joule Studio, you build in the browser or in your own development tool with the Joule Studio CLI and a coding agent connected over MCP; agents deploy to an SAP-managed runtime and register with Joule. In the pro-code route, you deploy to a customer-managed subaccount as a self-managed runtime, using the SAP Cloud SDK for AI and an agent framework. The page lists LangGraph, AG2, CrewAI, Smolagents, Google ADK and Pydantic AI. SAP's May 2026 Joule Studio announcement names LangChain, Pydantic AI and LlamaIndex for Joule Studio's pro-code capabilities (SAP News), and gives no GA date in that article. Intent-based development with Joule Studio is covered later in Unit 9.
SAP's Integrating AI Agents with Joule page (updated 26 October 2026) covers code-based agents built with any framework that supports A2A. Joule acts as the A2A client and sends message/send to the agent's endpoint. You create a Joule scenario with a dialog function of action type agent-request pointing at that endpoint, and set up an App2App trust in SAP Cloud Identity Services. The page gives the A2A version as 0.3.0, and its example is a Python LangGraph agent.
For the SDKs in this topic, that means:
Google ADK documents to_a2a() for exposing an agent with a generated agent card. Its quickstart notes that a2a-sdk 0.3.x runs in compatibility mode and that new integrations should target 1.x. Test against the A2A version Joule actually sends before you rely on it.
OpenAI Agents SDK and Claude Agent SDK: we found no A2A server in the documentation read for this topic. You would wrap the agent in an A2A server yourself, as in A2A for SAP agents.
SAP's architecture puts model access in the SAP Cloud SDK for AI. The SAP pages read for this topic don't describe an adapter for any of the three vendor SDKs. If your company reaches models only through the generative AI hub, check before choosing: the OpenAI Agents SDK accepts an OpenAI-compatible client, ADK accepts model connectors such as LiteLLM, and the Claude Agent SDK talks to Anthropic's API with an API key. Which of those paths your SAP contract supports is a question for your SAP account team, not something to assume.
Both Architecture Center pages above say some components are not yet generally available. The Agentic AI page says two-way communication with third-party and self-hosted agents through the Agent Gateway is "not yet supported". Treat Joule calling your agent as the supported direction today, and your agent calling Joule back as future.
Where it sits. The agent runs in a container in your BTP subaccount (Cloud Foundry or Kyma). Joule calls it over A2A. It reads S/4HANA through released APIs via the destination service, and calls a model either through the SAP Cloud SDK for AI or through the vendor's API. The draft goes to a workflow inbox, never straight into the sales order.
flowchart LR
J[Joule] -- A2A --> A[Order-exception agent<br/>SDK harness + your tools]
A -- released API --> S[S/4HANA sales orders]
A -- model calls --> M[Generative AI hub<br/>or vendor API]
A -- draft --> W[Approval inbox]
A -. traces .-> O[Your observability store]
Non-functional requirements that decide the design
Requirement
Typical target
What breaks if missed
Data residency of traces and sessions
Same region as the SAP data
Order values and customer names leave the region through default tracing
Approval survives restart
Pending approvals kept for at least one working day
A redeploy loses every waiting approval, and clerks redo work
Dependency footprint
Every package scanned and pinned
An unpinned minor release changes the API under a running agent
Latency per order
A few seconds for read and route
Clerks stop using it and work the worklist by hand
Integration and identity. SAP's A2A setup relies on an App2App trust in SAP Cloud Identity Services, and the Agentic AI page places principal propagation in the Agent Gateway. Design the agent's read calls to run as the requesting user, so SAP's authorizations apply (grounding with authorizations). The approval itself must check that the approver holds the right role: none of the three SDKs knows your role design.
Context: Calder needs a pro-code order-exception agent callable from Joule, with an approval before any draft.
Options: A) Google ADK; B) OpenAI Agents SDK; C) Claude Agent SDK; D) LangGraph.
Decision: A, Google ADK, with tools and rules in a plain module no SDK imports, and pending approvals held in our own table rather than the SDK's session store.
Consequences: on SAP's named list and with a documented A2A server; we must verify A2A version compatibility with Joule; switching to D later touches only the harness layer.
What a design review will ask
Where do traces and session data go, and who signed that off?
How does a pending approval survive a restart or redeploy?
Which A2A version does the agent serve, and was it tested against Joule?
Who may approve, and where is that checked in code?
What changes, and how much, if we switch SDKs next year?
Authorizations. The SDK's approval is a pause, not a permission. Check the approver's role in your own code before the gated tool runs, and keep the agent's SAP user limited to reads plus the draft.
Exactly once. The OpenAI guide says approval "does not guarantee exactly-once execution". Give each draft an idempotency key (here, CRR-<order>) and refuse a second draft for the same key.
State storage. The OpenAI SDK's RunState is a snapshot; its guide says to load snapshots only from trusted storage and to keep them server-side. ADK lists session stores that don't support confirmation. The Claude Agent SDK's callback lives inside the session. Decide where a pending approval lives before you pick the SDK.
Telemetry. Turn off or redirect vendor tracing unless your data protection officer agreed to it. Send traces to the store your evaluation uses (trajectory evaluation).
Footprint and upgrades. Pin exact versions. The Claude Agent SDK's bundled program makes the image large; plan container size and startup time on BTP.
Built-in powers. The Claude Agent SDK starts with Claude Code's tools unless you remove them. For an SAP agent, set tools=[] and setting_sources=[], and add only your own tools.
Evaluation. Run the same test set against each candidate SDK with the same model. Differences in tool calls usually come from instructions and tool descriptions, not the SDK; prove that before blaming the harness.
Clean core. Nothing in this design changes S/4HANA. The agent reads released APIs and writes a draft outside the core.
Choosing by demo. Every SDK's quickstart looks easy. The differences show at the pause, the trace and the restart; test those first.
Letting the SDK own your tools. Decorators are convenient, but business rules written inside SDK-specific types are what makes a switch expensive. Keep plain functions and wrap them.
Putting a gated tool in an auto-approve list. In the Claude Agent SDK, allowed_tools approves before can_use_tool runs. A draft tool listed there is never asked about.
Forgetting the default reject. An approval prompt that defaults to "yes" after a timeout is an automation, not an approval.
Assuming A2A versions match. SAP's page names 0.3.0; libraries move on. Test the real handshake.
Mixing two SDKs in one agent. Using one SDK's agent with another's tools doubles the dependencies and the failure modes. Pick one per agent.
#Exercise: approve only above a limit, in both SDKs
Calder's credit team says small requests don't need a person: below 10,000.00 USD (a course value) the agent may draft on its own. Make the approval conditional in both SDKs and prove both behave the same.
In unit09/sdk_twice.py, add a fourth order to ORDERS, after 1000006:
Notice the two signatures. The OpenAI SDK passes the run context, the arguments as a dictionary and the call ID. ADK passes the tool's own arguments by name; in our run an extra unannotated tool_context parameter made ADK fail with missing 1 required positional argument.
Done when order 1000013 shows paused for approval: no and Drafted CRR-1000013 in both SDKs even though the reviewer says reject, order 1000002 still pauses and drafts nothing, both runs end with Same tool calls and same approval behaviour in both SDKs: yes, and you can say in one sentence where the 10,000.00 rule lives and why it is not inside either SDK. Keep the file: the multi-agent topic later in Unit 9 puts a supervisor over this agent.
Pick one answer for each question. The explanation appears after you choose.
1In the "three seats" model, which part of the harness stays your code whichever SDK you choose?
Answer: C. The SDKs differ in who runs the loop, who holds the pause and where records go. The tools and rules decide whether the agent is safe, and keeping them in plain functions is what makes the SDK choice reversible.
2In the OpenAI Agents SDK route, how does the script answer a pending approval?
Answer: A. A gated tool makes the run return with result.interruptions. The script calls result.to_state(), then state.approve or state.reject for each item, and resumes with Runner.run(agent, state).
3In the ADK route, what tells the script that the run is waiting for a person?
Answer: D. With require_confirmation set, ADK emits a function call named adk_request_confirmation. The script answers in the same session with a function response of that name carrying confirmed true or false.
4Why does the script default the reviewer's answer to reject?
Answer: A. An approval that defaults to yes after nobody answers is an automation, not an approval. With reject as the default, a run without an explicit decision ends with nothing drafted.
5A colleague adds the draft tool to allowed_tools in the Claude Agent SDK route "so it runs smoothly". What happens?
Answer: B. The reference says allowed_tools auto-approves and that can_use_tool runs only when the permission flow falls through to a prompt. A gated tool must stay out of allowed_tools.
6Why does the Claude route set tools=[] and setting_sources=[]?
Answer: A. The SDK starts with Claude Code's built-in tools and loads settings, which can include hooks, from the computer. An SAP order agent needs neither, so both are switched off and only the agent's own tools remain.
7Your team picks an SDK SAP doesn't name, and Joule must call the agent. What is the first technical risk to test?
Answer: B. Joule reaches pro-code agents as an A2A client, and SAP's page gives the version as 0.3.0. For an SDK without a documented A2A server you wrap one yourself, so the handshake is the first thing to prove.
8The OpenAI guide says approval "does not guarantee exactly-once execution". What would you add before the draft tool writes to a real inbox?
Answer: D. A resumed or retried run can call an approved tool again. Keying each draft, for example CRR-, and refusing a second one with the same key makes a repeat harmless.
New Joule Studio: enterprise-scale agentic development (SAP News, 13 May 2026)— pro-code capabilities that "support frameworks such as LangChain, Pydantic AI, and LlamaIndex"; agentic IDEs such as Visual Studio Code and Cursor; managed Joule Studio runtime; long-term memory powered by SAP HANA Cloud described as coming; no GA date; free design-time access through the end of 2026
Agentic AI & AI Agents on SAP Business AI Platform (SAP Architecture Center, updated 26 October 2026)— SAP Cloud SDK for AI in Python, Java and JavaScript/TypeScript; agent frameworks LangGraph, AG2, CrewAI, Smolagents, Google ADK and Pydantic AI; Joule Studio pro-code flow with the Joule Studio CLI and a coding agent connected via MCP; SAP-managed runtime versus a customer-managed subaccount; Agent Gateway; not-yet-GA disclaimer; bidirectional communication with self-hosted agents through Agent Gateway not yet supported
Human-in-the-loop (OpenAI Agents SDK documentation)— needs_approval on function tools (bool or async callable); result.interruptions with ToolApprovalItem; result.to_state(), state.approve and state.reject; resume with Runner.run(agent, state); RunState serialization; keep snapshots server-side; approval "does not guarantee exactly-once execution"
Models (OpenAI Agents SDK documentation)— Responses API by default; OpenAI-compatible endpoints through set_default_openai_client or OpenAIChatCompletionsModel; LiteLLM and Any-LLM adapters described as best-effort beta; traces upload to OpenAI's servers unless tracing is disabled or another processor is used
Agent SDK overview (Claude Code documentation)— the same tools, agent loop and context management that power Claude Code, in Python and TypeScript; "a library that runs the Claude Code binary"; built-in tools, hooks, subagents, MCP, permissions, sessions; Managed Agents as Anthropic's hosted option; claude.ai login not allowed for third-party products; governed by Anthropic's Commercial Terms of Service
Agent SDK reference: Python (Claude Code documentation)— query() versus ClaudeSDKClient; custom tools with @tool and create_sdk_mcp_server, named mcp__server__tool; allowed_tools auto-approves and does not restrict; can_use_tool with PermissionResultAllow and PermissionResultDeny; permission modes; system_prompt, mcp_servers, max_turns
Get action confirmation for ADK tools (Agent Development Kit documentation)— FunctionTool with require_confirmation (bool or function), Python from v1.14.0; advanced confirmation with tool_context.request_confirmation; client answers with a function response named adk_request_confirmation carrying confirmed; not supported with DatabaseSessionService and VertexAiSessionService; experimental in TypeScript, Go and Kotlin