|
| 1 | +# Examples Verification Report |
| 2 | + |
| 3 | +**Date:** 2026-07-18 · **Branch:** `examples/verification-and-fixes` · **Base:** `7481aed2` |
| 4 | + |
| 5 | +Full verification of the SDK example catalog against a live Conductor server, with |
| 6 | +fixes for every reproducible example bug found. This report tracks the status of each |
| 7 | +suite so it can be re-checked as the SDK and server evolve. |
| 8 | + |
| 9 | +## Environment |
| 10 | + |
| 11 | +| Component | Value | |
| 12 | +|-----------|-------| |
| 13 | +| Server | conductor-oss **3.32.0-rc.8** boot JAR (Maven Central), `java -jar --server.port=8080` | |
| 14 | +| Python | 3.12.13 (uv venv), `pip install -e '.[agents]'` | |
| 15 | +| Platform | macOS (darwin arm64) — worker processes use the **spawn** start method | |
| 16 | +| LLM | `AGENTSPAN_LLM_MODEL=openai/gpt-4o-mini`, `OPENAI_API_KEY` + `ANTHROPIC_API_KEY` set | |
| 17 | +| Harness | `examples/agents/run_all_examples.py --jobs 8 --timeout 360` + curated core-example runner | |
| 18 | + |
| 19 | +### ⚠️ Server version requirement (root cause of the most common failure) |
| 20 | + |
| 21 | +The agent examples need the **agent runtime**, on by default from conductor-oss |
| 22 | +**3.32.0-rc.8** (the version pinned in `.github/workflows/agent-e2e.yml`). The `latest` |
| 23 | +JAR installed by `conductor server start` is the 3.30.x stable line, which has **no |
| 24 | +`/api/agent/*` endpoints** — every agent example fails with |
| 25 | +`AgentNotFoundError: HTTP 404 ... api/agent/start`. On 3.30.2 the suite scored |
| 26 | +3 PASS / 103 ERROR; on 3.32.0-rc.8 (same code) it scored 96 PASS / 2 ERROR. |
| 27 | + |
| 28 | +Workaround (works today, `conductor-server-3.32.0-rc.8.jar` is already in the CLI's S3 |
| 29 | +bucket): `conductor server start --version 3.32.0-rc.8`. Decision: do **not** repoint |
| 30 | +the CLI's floating `latest` at an rc — this resolves itself when 3.32.0 GA ships. |
| 31 | + |
| 32 | +## Results — agents suite (`examples/agents/`, 146 files) |
| 33 | + |
| 34 | +`run_all_examples.py` after the fixes in this PR: |
| 35 | + |
| 36 | +| Status | Count | Notes | |
| 37 | +|--------|------:|-------| |
| 38 | +| PASS | 96 | end-to-end against the live server, real LLM calls | |
| 39 | +| SKIP | 46 | interactive / daemon-by-design / external infra (MCP, Docker, Kafka, Slack, OCG, skills repo, messages API) | |
| 40 | +| ERROR | 2 | see "Remaining failures" | |
| 41 | +| HUNG | 2 | see "Remaining failures" | |
| 42 | + |
| 43 | +Before fixes (same server): 91 PASS / 12 ERROR / 3 HUNG / 40 SKIP. |
| 44 | + |
| 45 | +## Results — core suite (curated, 18 examples) |
| 46 | + |
| 47 | +| Example | Status | Notes | |
| 48 | +|---------|--------|-------| |
| 49 | +| workers_e2e.py | ✅ fixed | workers run clean; e2e workflow COMPLETED server-side; blocks on `join_processes()` by design | |
| 50 | +| worker_example.py | ✅ fixed | runs clean as a worker daemon | |
| 51 | +| task_listener_example.py | ✅ fixed | all workers start, listeners fire, no spawn errors | |
| 52 | +| helloworld/helloworld.py | ✅ fixed | exits 0 | |
| 53 | +| worker_configuration_example.py | ✅ | | |
| 54 | +| task_workers.py | ✅ | | |
| 55 | +| dynamic_workflow.py | ✅ | | |
| 56 | +| workflow_ops.py | ✅ | | |
| 57 | +| workflow_status_listner.py | ✅ | | |
| 58 | +| kitchensink.py | ✅ | | |
| 59 | +| task_configure.py | ✅ | | |
| 60 | +| metadata_journey_oss.py | ✅ | | |
| 61 | +| schedule_journey.py | ✅ | | |
| 62 | +| event_listener_examples.py | ✅ | | |
| 63 | +| lease_extension_example.py | ✅ | ~62s | |
| 64 | +| agentic_workflows/llm_chat.py | ✅ fixed | previously a **false pass** — reported success while the workflow FAILED server-side | |
| 65 | +| task_context_example.py | ➖ daemon | runs until Ctrl+C by design; workers run clean | |
| 66 | +| agentic_workflows/function_calling_example.py | ➖ interactive | reads stdin; not runnable headless | |
| 67 | + |
| 68 | +Static check: every `.py` under `examples/` compiles (`compileall`). Unit tests: |
| 69 | +`tests/unit/ai` — 1744 passed. |
| 70 | + |
| 71 | +## Bugs found and fixed in this PR |
| 72 | + |
| 73 | +1. **`examples/helloworld/greetings_worker.py` — duplicate `def greet`.** The module |
| 74 | + defined `greet` twice (tasks `greet` and `greet_sync`); the second shadowed the |
| 75 | + first, so spawn-pickling the first failed with |
| 76 | + `PicklingError: not the same object as helloworld.greetings_worker.greet`. Broke |
| 77 | + `workers_e2e.py`, `helloworld.py`, and `task_listener_example.py` on macOS/Windows. |
| 78 | + Renamed the second function `greet_sync`. |
| 79 | + |
| 80 | +2. **`src/conductor/ai/agents/tool.py` — SDK bug: worker-task tool lookup broken after |
| 81 | + re-registration.** `ToolRegistry.register_tool_workers` overwrites a |
| 82 | + `@worker_task` tool's `_decorated_functions` entry with a spawn-safe |
| 83 | + `ToolWorkerEntry` wrapper; the identity check in `_try_worker_task` then failed for |
| 84 | + the same tool later in the same run |
| 85 | + (`TypeError: Expected a @tool-decorated function ...`). Broke |
| 86 | + `14_existing_workers.py`. The lookup now walks `__wrapped__` chains and the |
| 87 | + wrapper's `fn_direct`/`fn_ref` carriers. Two regression tests added. |
| 88 | + |
| 89 | +3. **`examples/worker_example.py` — hardcoded `/Users/viren/` metrics path.** |
| 90 | + `PermissionError` on any other machine. Now uses `tempfile.gettempdir()`. |
| 91 | + |
| 92 | +4. **`examples/user_example/user_workers.py` — inconsistent package identity.** |
| 93 | + Imported `examples.user_example.models` while every consumer loads the module as |
| 94 | + `user_example.user_workers`; spawn children (which only inherit `PYTHONPATH`, not |
| 95 | + runtime `sys.path` edits) crashed. Import is now package-relative-consistent. |
| 96 | + |
| 97 | +5. **`examples/agents/kitchen_sink.py` — `@agent` classifiers declared a required |
| 98 | + `prompt` arg.** `@agent`-decorated functions are invoked with zero args at compile |
| 99 | + time for dynamic instructions → `TypeError`. Signatures fixed. |
| 100 | + |
| 101 | +6. **`examples/agents/16i/16j` — tools defined inside factory functions.** |
| 102 | + `<locals>` callables can't be re-imported by spawn workers → |
| 103 | + `SpawnSafetyError`. Tools hoisted to module level; both now pass. |
| 104 | + |
| 105 | +7. **`examples/agents/94_openai_runner_tools.py` — `@function_tool` rebinding.** The |
| 106 | + decorator rebinds the module global to a `FunctionTool`, so the extracted original |
| 107 | + couldn't be pickled by reference. The example now keeps the plain function at module |
| 108 | + level and applies `function_tool()` at `Agent(...)` construction; passes end-to-end. |
| 109 | + |
| 110 | +8. **`examples/agentic_workflows/llm_chat.py` — two bugs.** (a) Two LLM tasks sent |
| 111 | + **system-only** message lists; the server requires a non-empty user message and |
| 112 | + failed the workflow before the first task ran. (b) The example treated any terminal |
| 113 | + state as success (`is_completed()`), printing "Conversation complete." over a FAILED |
| 114 | + workflow and exiting 0. Both fixed; a full 3-turn conversation now completes. |
| 115 | + |
| 116 | +9. **`examples/agents/run_all_examples.py` — skip-list updates.** Six examples that |
| 117 | + need infra this environment (and CI's pinned server) don't provide are now |
| 118 | + classified SKIP with reasons: `30`/`32` (need the `dg` skill cloned into |
| 119 | + `~/.claude/skills/dg`), `75`/`82`/`83`/`84` (need the workflow *messages* API, |
| 120 | + `GET /api/workflow/{id}/messages`, which is not in conductor-oss 3.32.0-rc.8). |
| 121 | + |
| 122 | +10. **`examples/agents/README.md`** — added the server-version requirement + start |
| 123 | + commands; fixed the provider/model table (OpenAI row showed the Anthropic default |
| 124 | + string); renumbered setup steps. **`examples/README.md`** — added the same server |
| 125 | + note to the AI Agents section. |
| 126 | + |
| 127 | +## Remaining failures (known, not fixed here) |
| 128 | + |
| 129 | +| Example | Status | Diagnosis | |
| 130 | +|---------|--------|-----------| |
| 131 | +| `agents/kitchen_sink.py` | ERROR | Fixed classifier TypeError, now fails server-side: `HTTP 500 — The Task translation_swarm defined as a sub-workflow has no workflow definition available`. Sub-workflow (SWARM strategy) definitions aren't registered before `/agent/start` on conductor-oss rc.8. Needs SDK/server investigation. | |
| 132 | +| `agents/74_cli_error_output.py` | FLAKY | LLM-behavior assertion: the agent paraphrases stderr instead of quoting it verbatim; passes/fails depending on model output. Consider loosening the assertion or pinning a stricter prompt. | |
| 133 | +| `agents/86_coding_agent.py` | HUNG | Does not finish within 420s even running solo. Needs investigation (or reclassification if it is expected to be long-running). | |
| 134 | +| `agents/68_context_condensation.py` | SLOW | Passes solo in ~346s; exceeds the suite timeout under 8-way contention. Consider `--timeout 480` for suite runs or trimming the example. | |
| 135 | + |
| 136 | +## SDK observations (follow-ups, out of scope for this PR) |
| 137 | + |
| 138 | +- **`AgentNotFoundError` should name the server-version requirement.** When |
| 139 | + `/api/agent/start` 404s ("No static resource"), the error in |
| 140 | + `orkes_agent_client.py` should suggest conductor-oss ≥ 3.32.0-rc.8 and the |
| 141 | + `conductor server start --version` command. This would have made the most common |
| 142 | + failure self-explanatory. |
| 143 | +- **`run_all_examples.py` preflight**: check `GET /api/version` + probe an agent |
| 144 | + endpoint before launching 100+ subprocesses against a server that can't run them. |
| 145 | +- **openai-agents `@function_tool` at module level is spawn-unsafe by construction** |
| 146 | + (the global is rebound to a `FunctionTool`; the original function is only reachable |
| 147 | + through a closure, which `FunctionRef` can't express). Teaching the spawn-safety |
| 148 | + layer a closure hop — or documenting the `function_tool(fn)`-at-construction pattern |
| 149 | + — would let users keep the upstream OpenAI sample shape. |
| 150 | + |
| 151 | +## How to reproduce |
| 152 | + |
| 153 | +```bash |
| 154 | +# server |
| 155 | +curl -fL -o conductor-server.jar "https://repo1.maven.org/maven2/org/conductoross/conductor-server/3.32.0-rc.8/conductor-server-3.32.0-rc.8-boot.jar" |
| 156 | +OPENAI_API_KEY=... ANTHROPIC_API_KEY=... java -jar conductor-server.jar --server.port=8080 |
| 157 | + |
| 158 | +# SDK + suite |
| 159 | +uv venv --python 3.12 .venv && VIRTUAL_ENV=$PWD/.venv uv pip install -e '.[agents]' |
| 160 | +export CONDUCTOR_SERVER_URL=http://localhost:8080/api AGENTSPAN_LLM_MODEL=openai/gpt-4o-mini |
| 161 | +python examples/agents/run_all_examples.py --jobs 8 --timeout 360 |
| 162 | +``` |
0 commit comments