SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.19425 · 2024

Adaptive In-conversation Team Building for Language Model Agents

arXiv · PDF · Open in the Atlas

Code that ran

4 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 4 failures of our instrument; 3 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2405.19425.json · badge: /api/ran/2405.19425.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
ag2ai/ag2 canonical (classifier label)
classifier basis: census
4 ran · 3 no recorded run
FunctionStatusWhere it lives
close_unanswered_tool_calls Ran
ran; our contract draft was wrong, not the code
ag2ai/ag2/ag2/history.py
code served (permissive licence) · get_code("4ef11c99a05fb0d3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned coroutine. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from dataclasses import dataclass
from typing import Sequence, Optional, List
import asyncio


@dataclass
class ToolCall:
    id: str
    name: str


@dataclass
class ToolResult:
    result: str


@dataclass
class ToolCallsContainer:
    calls: List[ToolCall]


@dataclass
class BaseEvent:
    pass


@dataclass
class ModelResponse(BaseEvent):
    tool_calls: Optional[ToolCallsContainer] = None


@dataclass
class ToolCallsEvent(BaseEvent):
    calls: List[ToolCall]


@dataclass
class ToolResultEvent(BaseEvent):
    parent_id: str
    name: str
    result: ToolResult


@dataclass
class ToolResultsEvent(BaseEvent):
    results: List[ToolResultEvent]


class History:
    def __init__(self, events: List[BaseEvent]):
        self._events = events
    
    async def get_events(self) -> List[BaseEvent]:
        return self._events
    
    async def replace(self, events: List[BaseEvent]) -> None:
        self._events = events


def _tool_call_batches(events: 'Sequence[BaseEvent]') -> 'list[ToolCallsEvent]':
    """Every batch of tool calls in ``events``, from either place they appear."""
    batches: list[ToolCallsEvent] = []
    seen: set[str] = set()
    for event in events:
        calls = event.tool_calls.calls if isinstance(event, ModelResponse) and event.tool_calls else event.calls if isinstance(event, ToolCallsEvent) else []
        fresh = [call for call in calls if call.id not in seen]
        if not fresh:
            continue
        seen.update((call.id for call in fresh))
        batches.append(ToolCallsEvent(fresh))
    return batches


async def close_unanswered_tool_calls(history: 'History', *, result: str) -> int:
    """Close off tool calls a stopped turn left unanswered. Returns how many."""
    events = list(await history.get_events())
    settled = {r.parent_id for e in events if isinstance(e, ToolResultsEvent) for r in e.results}
    completed = {e.parent_id: e for e in events if isinstance(e, ToolResultEvent) and e.parent_id not in settled}
    repaired: list[ToolResultsEvent] = []
    closed = 0
    for event in _tool_call_batches(events):
        pending = [call for call in event.calls if call.id not in settled]
        if not pending:
            continue
        results = []
        for call in pending:
            done = completed.get(call.id)
            results.append(done if done is not None else ToolResultEvent(parent_id=call.id, name=call.name, result=ToolResult(result)))
            closed += int(done is None)
        repaired.append(ToolResultsEvent(results))
    if not repaired:
        return 0
    await history.replace([*events, *repaired])
    return closed


# Setup for test case with unanswered tool calls
call1 = ToolCall(id="call_1", name="tool_a")
call2 = ToolCall(id="call_2", name="tool_b")
call3 = ToolCall(id="call_3", name="tool_c")

model_response = ModelResponse(tool_calls=ToolCallsContainer(calls=[call1, call2]))
tool_calls_event = ToolCallsEvent(calls=[call1, call2])
tool_result_event = ToolResultEvent(parent_id="call_1", name="tool_a", result=ToolResult("success"))
tool_results_event = ToolResultsEvent(results=[tool_result_event])

# Events: call_1 has result, call_2 and call_3 are unanswered
events = [
    model_response,
    tool_calls_event,
    tool_results_event,
    ToolCallsEvent(calls=[call3]),
]

history = History(events)

ARGS = {
    "history": history,
    "result": "Turn was cancelled",
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type coroutine — a coroutine output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a coroutine output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_missing_imports Ran
ran; our contract draft was wrong, not the code
ag2ai/ag2/ag2/_import_utils.py
code served (permissive licence) · get_code("0b66e78733b6fa05")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import sys

# Setup: ensure some modules are in sys.modules for testing
class MockModule:
    __file__ = "/path/to/mock/module.py"

sys.modules['numpy'] = MockModule()
sys.modules['torch'] = MockModule()
sys.modules['scipy'] = MockModule()

# Test case 1: single module string that exists
# Test case 2: iterable of modules, some missing, some present
ARGS = {
    "modules": ["numpy", "torch", "nonexistent_module_xyz", "another_missing_one"]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
missing_additional_dependency Ran
ran; our contract draft was wrong, not the code
ag2ai/ag2/ag2/exceptions.py
code served (permissive licence) · get_code("4f0a5a72c05098a4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Mock. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from unittest.mock import Mock

name = "test_package"
dependency = "optional_dep"
error = ImportError("Original error message")

ARGS = {
    "name": name,
    "dependency": dependency,
    "error": error,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Mock — a Mock output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
missing_optional_dependency Ran
ran; our contract draft was wrong, not the code
ag2ai/ag2/ag2/exceptions.py
code served (permissive licence) · get_code("6a15da2c46cc02e1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Mock. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from unittest.mock import Mock

# Construct arguments for missing_optional_dependency
name = "TestModule"
extra = "test_extra"
error = ImportError("Base import error")

ARGS = {
    "name": name,
    "extra": extra,
    "error": error,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Mock — a Mock output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
patch_object Not yet run
unverified (harvested, no recorded run)
ag2ai/ag2/ag2/_import_utils.py
code served (permissive licence) · get_code("4d3bf98e05bfb046")
How it ran

no invocation recorded.

require_optional_import Not yet run
unverified (harvested, no recorded run)
ag2ai/ag2/ag2/_import_utils.py
code served (permissive licence) · get_code("c85f19bbfd003ea2")
How it ran

no invocation recorded.

unanswered_tool_calls Not yet run
unverified (harvested, no recorded run)
ag2ai/ag2/ag2/history.py
code served (permissive licence) · get_code("ae48d965eef3a01c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Leveraging multiple large language model (LLM) agents has shown to be a promising approach for tackling complex tasks, while the effective design of multiple agents for a particular application remains an art. It is thus intriguing to answer a critical question: Given a task, how can we build a team of LLM agents to solve it effectively? Our new adaptive team-building paradigm offers a flexible solution, realized through a novel agent design named Captain Agent. It dynamically forms and manages teams for each step of a task-solving process, utilizing nested group conversations and reflection to ensure diverse expertise and prevent stereotypical outputs, allowing for a flexible yet structured approach to problem-solving. A comprehensive evaluation across six real-world scenarios demonstrates that Captain Agent significantly outperforms existing multi-agent methods with 21.94% improvement in average accuracy, providing outstanding performance without requiring task-specific prompt engineering. Our exploration of different backbone LLM and cost analysis further shows that Captain Agent can improve the conversation quality of weak LLM and achieve competitive performance with extremely low cost, which illuminates the application of multi-agent systems.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2405.19425")
get_code_for_paper("2405.19425")
have("2405.19425")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2405.19425.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2405.19425.svg)](https://syntology.ai/paper/2405.19425)

Connect an agent — have() is free.