Thread

Thread represents a novel and superior approach to multi-agent and human-in-the-loop LLM systems. Existing multi-agent implementations involve hardcoding agents and their interactions—the architecture is fixed before the model runs. Thread gives models a Python tool with 3 primitives—fork, wait, and send. Models use these to self-assemble multi-agent systems at runtime.

Inspiration

General methods beat hand-crafted solutions in AI. Chess engines use search + learning instead of evaluation functions. Go uses self-play + neural nets instead of expert patterns. Vision uses CNNs + data instead of feature engineering.

Thread applies this principle to multi-agent systems: learned orchestration beats hardcoded frameworks.

What Emerged

Thread provides three primitives:

fork(prompt)              # spawn an agent
send(handle, message)     # message an agent
wait(handle)              # await response

When asked to iterate on a haiku, Claude wrote actor-critic:

actor = fork("Write a haiku about AI")
critic = fork(f"Evaluate: {wait(actor)}")

for round in range(3):
    feedback = wait(critic)
    revision = send(actor, f"Revise: {feedback}")
    send(critic, f"Re-evaluate: {wait(revision)}")

When asked to compare the persuasiveness of arguments, it wrote tournament brackets. When asked to optimize matrix multiplication, it implemented AlphaEvolve with evolutionary algorithms and population pools in 10 lines at runtime. The multi-agent system self-assembles at runtime.

Human-in-the-Loop

To the model, the user is just another agent—it can send messages to and receive messages from the user using the same primitives. Canvas UI visualizes the agent tree in real-time. Every agent is fully observable and steerable in real time, enabling extremely fine-grained human-in-the-loop interactions.

How We Built It

Backend: TypeScript/Bun runtime executing Python with bidirectional RPC between the two environments. TypeScript can call Python code that calls back into TypeScript functions:

python(`
x = 5
y = 3
result = add(x, y)
`, {
  add: (a, b) => a + b
})

This enables fork/send/wait primitives. Agents run in parallel with message-passing orchestration. Python state persists across tool calls without restarting the interpreter.

Frontend: React canvas UI that visualizes agents in real-time.

Challenges

Bidirectional communication between TypeScript and Python. Python state persistence across tool calls. Race conditions in message passing. Streaming multiple agents simultaneously. Making human interaction work naturally—agents can message humans during execution, not just at the end.

What We Learned

Models write orchestration patterns we didn’t anticipate. Claude invented actor-critic, evolutionary algorithms, and tournament brackets from three primitives. Self-programmed orchestration is superior to hardcoded frameworks—adaptable to any task and fully steerable.​​​​​​​​​​​​

Built With

Share this project:

Updates