* docs: organize SDK guides and clarify examples * fix: correct native SDK type declarations * test: update native SDK contract fixtures * fix: normalize persisted agent profile transport settings * test: reconcile inherited model settings API snapshot * test: preserve executor coverage on Windows --------- Co-authored-by: markstuart-oai <323302876+markstuart-oai@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| media | ||
| agent_lifecycle_example.py | ||
| dynamic_system_prompt.py | ||
| hello_world.py | ||
| hello_world_gpt_5.py | ||
| hello_world_gpt_oss.py | ||
| hello_world_jupyter.ipynb | ||
| image_tool_output.py | ||
| lifecycle_example.py | ||
| local_file.py | ||
| local_image.py | ||
| non_strict_output_type.py | ||
| previous_response_id.py | ||
| prompt_template.py | ||
| README.md | ||
| remote_image.py | ||
| remote_pdf.py | ||
| retry.py | ||
| retry_litellm.py | ||
| stream_function_call_args.py | ||
| stream_items.py | ||
| stream_text.py | ||
| stream_ws.py | ||
| tool_guardrails.py | ||
| tools.py | ||
| trace_redaction.py | ||
| usage_tracking.py | ||
Basic Classic examples
These scripts introduce one Classic API feature at a time. Complete example setup, then run a module from the repository root:
python -m examples.classic.basic.hello_world
| Task | Scripts |
|---|---|
| Run an agent | hello_world.py, hello_world_gpt_5.py |
| Use a local GPT-OSS model through Ollama | hello_world_gpt_oss.py |
| Declare tools and inspect tool output | tools.py, image_tool_output.py |
| Stream text, items, or function arguments | stream_text.py, stream_items.py, stream_function_call_args.py |
| Stream over a Responses WebSocket | stream_ws.py |
| Supply image or PDF input | local_image.py, remote_image.py, local_file.py, remote_pdf.py |
| Configure prompts and structured output | dynamic_system_prompt.py, prompt_template.py, non_strict_output_type.py |
| Inspect lifecycle hooks and usage | agent_lifecycle_example.py, lifecycle_example.py, usage_tracking.py |
| Gate tool inputs and outputs | tool_guardrails.py |
| Continue a server-stored response | previous_response_id.py |
| Configure retries | retry.py, retry_litellm.py |
| Export redacted trace snapshots without model requests | trace_redaction.py |
The notebook hello_world_jupyter.ipynb uses the same Classic imports. Select a kernel from the SDK environment before running its cells.
Example-specific setup
hello_world_gpt_oss.pyconnects to Ollama athttp://localhost:11434/v1with modelgpt-oss:20b. The script's comments link the model setup guides.prompt_template.pyrefers to a project-owned saved prompt with apoem_stylevariable and version1. Its embedded prompt ID does not grant access in your project. After creating your own prompt, usepython -m examples.classic.basic.prompt_template --prompt-id your-prompt-id; add--dynamicfor the callback variant.retry_litellm.pyuses theclassic-litellmextra. Its model configuration requires access to the provider named in the script.stream_ws.pyreadsOPENAI_MODEL,OPENAI_BASE_URL, andOPENAI_WEBSOCKET_BASE_URLfor optional overrides. The default model isgpt-5.6-sol.- The local image and PDF examples read the bundled
media/files relative to the script. The remote examples submit public URLs to the model API.