complex_agent

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: BSD-3-Clause Imports: 15 Imported by: 0

README

Complex OpenAI agent example

This example runs a realistic, read-only incident investigation with an OpenAI Responses model. It demonstrates:

  • four custom tools with JSON Schema parameters;
  • run-scoped region metadata available inside tools;
  • built-in task planning and plan updates;
  • parallel tool execution with a concurrency limit;
  • precise context compression;
  • before/after execution callbacks;
  • streamed final-answer output and token accounting.

The operational data is deterministic and embedded in the example. No production service is queried or modified.

Run

export OPENAI_API_KEY="your-api-key"
export OPENAI_MODEL="gpt-5.2" # optional; gpt-5.2 is the default

go run ./example/complex_agent

Use a custom question or timeout:

go run ./example/complex_agent \
  -question "Investigate the EU checkout errors and recommend a safe mitigation." \
  -timeout 2m

OPENAI_BASE_URL can optionally point to an OpenAI-compatible Responses API endpoint.

The agent is intentionally given only read-only tools. Its final response should distinguish observed evidence from hypotheses and recommend, rather than claim to execute, mitigations.

Documentation

Overview

Command complex_agent demonstrates a multi-step OpenAI agent with planning, parallel tool execution, run-scoped metadata, callbacks, context compression, final-answer streaming, and token accounting.

The tools use deterministic in-memory incident data so the example only needs an OpenAI API key and never touches a production system.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL