Example code

Claude Agent SDK examples: outputs

Open a file to read it highlighted, with links to where the tutorial uses it.

Download all examples (zip)

NameWhat it showsUsed inSize
01_hello.txtCaptured output of 01_hello1.8 KB · raw
02_fix_bugs.txtCaptured output of 02_fix_bugs922 B · raw
03_multi_turn.txtCaptured output of 03_multi_turn204 B · raw
04_custom_tools.txtCaptured output of 04_custom_tools964 B · raw
05_hooks.txtCaptured output of 05_hooks708 B · raw
06_structured_output.txtCaptured output of 06_structured_output887 B · raw
07_streaming.txtCaptured output of 07_streaming374 B · raw
08_subagents.txtCaptured output of 08_subagents1.3 KB · raw
09_sessions.txtCaptured output of 09_sessions747 B · raw
10_permissions.txtCaptured output of 10_permissions688 B · raw
11_checkpointing.txtCaptured output of 11_checkpointing217 B · raw
12_interrupt.txtCaptured output of 12_interrupt231 B · raw
13_introspection.txtCaptured output of 13_introspection1.3 KB · raw
14_errors.txtCaptured output of 14_errors779 B · raw
15_skills_and_prompts.txtCaptured output of 15_skills_and_prompts1.4 KB · raw
16_cost_tracking.txtCaptured output of 16_cost_tracking491 B · raw
17_streaming_input.txtCaptured output of 17_streaming_input956 B · raw
18_otel_capture.txtCaptured output of 18_otel_capture444 B · raw
19_sqlite_session_store.txtCaptured output of 19_sqlite_session_store450 B · raw
20_multi_tenant.txtCaptured output of 20_multi_tenant1.8 KB · raw
21_sandbox_and_stderr.txtCaptured output of 21_sandbox_and_stderr1.2 KB · raw
22_concurrency_sizing.txtCaptured output of 22_concurrency_sizing344 B · raw
p1_goal_loop.txtCaptured output of p1_goal_loop557 B · raw
p1b_goal_loop_blocked.txtCaptured output of p1b_goal_loop_blocked623 B · raw
p2_graph_pipeline.txtCaptured output of p2_graph_pipeline1.6 KB · raw
p3_workflow_patterns.txtCaptured output of p3_workflow_patterns3.4 KB · raw
p4_handoff.txtCaptured output of p4_handoff1.0 KB · raw
p5_debate.txtCaptured output of p5_debate2.3 KB · raw
p6_agentic_rag.txtCaptured output of p6_agentic_rag2.3 KB · raw
p7_deferred_approval.txtCaptured output of p7_deferred_approval418 B · raw
p8_eval_gate.txtCaptured output of p8_eval_gate396 B · raw
p9_circuit_breaker.txtCaptured output of p9_circuit_breaker788 B · raw
ts_agent.txtCaptured output of ts_agent518 B · raw