Repository navigation
Commit 2a3e64d
committed
Fix tool-call extraction and populate events on the run() path
Tool tasks were identified by a `call_` reference-name prefix. That prefix is
the LLM provider's tool-call id format, not something the server adds, so an
Anthropic-backed agent (`toolu_…`) recorded no tool calls at all. Five tool
kinds were also filtered out as system tasks and five more were named from the
task type, and `run()` never passed `events=` at all.
Identify a tool by the task type it compiled to, per the server's
`ToolCompiler.TYPE_MAP`, and resolve its name from `_agent_tool_name` — which
the tool-dispatch script sets on every tool kind — falling back to `method` and
the task definition. Nothing reads the reference name for identity, so nothing
depends on provider-controlled data. Names are no longer case-folded, so
`getWeather` stops arriving as `getweather`.
`agent_tool` and a strategy handoff both compile to SUB_WORKFLOW; only the tool
carries `_agent_tool_name`, which is what tells them apart. The agent's own
statically-compiled workers — guardrails, callbacks, gates, routing — compile to
SIMPLE tasks like a worker tool does, so they are excluded by name; that check
is consulted only after the dispatch key has failed to settle the question.
`run()` and `run_async()` now derive `events` from the execution they already
fetch for `tool_calls`, with no extra call. Eight assertions in
`conductor.ai.agents.testing` read `events`, and four of them check for absence —
including `assert_no_errors`, which the eval runner runs on every case — so they
were passing without evidence. `expect_handoff_to`, used by the eval runner's
own documented example, was failing every time.
The task-to-event mapping was copy-pasted across the sync and async polling
streams; both now share `_task_events`, which is also what `run()` uses, so an
assertion reads the same whichever way the agent was run.
Verified against a live server: before, an Anthropic-backed agent with one tool
returned `tool_calls: []` and `events: []`; after, `[('getWeather', {'city':
'Tokyo'})]` and a full event list. The OpenAI path is unchanged apart from the
name no longer being lowercased.1 parent c99e2cf commit 2a3e64d
5 files changed
Lines changed: 891 additions & 294 deletions
File tree
- src/conductor/ai/agents
- runtime
- tests/unit/ai
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
| |||
691 | 693 | | |
692 | 694 | | |
693 | 695 | | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
694 | 712 | | |
695 | 713 | | |
696 | 714 | | |
| |||
723 | 741 | | |
724 | 742 | | |
725 | 743 | | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | 744 | | |
730 | 745 | | |
731 | 746 | | |
| |||
738 | 753 | | |
739 | 754 | | |
740 | 755 | | |
741 | | - | |
| 756 | + | |
742 | 757 | | |
743 | 758 | | |
744 | 759 | | |
| |||
0 commit comments