multi_agent_state_guide_2025

multi_agent_state_guide_2025 is an agent for coding agents from pr1m8/haive. It costs 0 tokens per session (2,819 once invoked), scanned A, original, MIT.

A guide to MultiAgentState, a shared data structure for workflows where several agents perform separate but connected tasks. It covers isolated agent data, execution order, and recompilation tracking.

In plain words
What is it for?
Use it when designing Haive workflows with multiple agents, tracking which agent is active, storing outputs, or rebuilding workflows after changes.
Why use it?
It helps developers keep each agent’s state separate while still passing results through a multi-agent workflow.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/pr1m8/haive/multi_agent_state_guide_2025
Clone the repo
git clone --depth 1 https://github.com/pr1m8/haive

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for multi_agent_state_guide_2025

README.md
[![agentmods](https://agentmods.dev/badge/agents/pr1m8/haive/multi_agent_state_guide_2025.svg)](https://agentmods.dev/agents/pr1m8/haive/multi_agent_state_guide_2025)
Your own site
<a href="https://agentmods.dev/agents/pr1m8/haive/multi_agent_state_guide_2025"><img src="https://agentmods.dev/badge/agents/pr1m8/haive/multi_agent_state_guide_2025.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,819 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02819
Opus 5 $0.00000 $0.01409
Sonnet 5 $0.00000 $0.00564
Haiku 4.5 $0.00000 $0.00282

Measured 4d ago against content hash 5bb8b523b4fb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

multi_agent_state_guide_2025 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

project_docs/guides/agents/multi_agent_state_guide_2025.md · 485 lines

How it starts

The opening of the file, as written. The whole thing — 485 lines — stays where its author put it; the contents beside it link to each section on GitHub.

MultiAgentState Guide - Haive Framework

Date: August 7, 2025
Version: 1.0
Purpose: Comprehensive guide to MultiAgentState schema and patterns

🎯 Overview

MultiAgentState is the core state container for multi-agent workflows in Haive. It provides:

  • State isolation between agents without schema flattening
  • Direct field updates for structured output agents
  • Recompilation tracking for dynamic workflows
  • Clean data flow between sequential agents

📋 Core Architecture

Class Definition

from haive.core.schema.prebuilt.multi_agent_state import MultiAgentState
from haive.core.schema.tool_state import ToolState

class MultiAgentState(ToolState):
    """Container state for multi-agent workflows."""
    
    # Agent storage (list or dict)
    agents: list[Any] | dict[str, Any]
    
    # Isolated state for each agent
    agent_states: dict[str, dict[str, Any]]
    
    # Execution tracking
    active_agent: str | None
    agent_outputs: dict[str, Any]  # Legacy message pattern
    agent_execution_order: list[str]
    
    # Recompilation management
    agents_needing_recompile: set[str]
    recompile_count: int
    recompile_history: list[dict[str, Any]]

Key Insight: No Schema Flattening

Unlike previous approaches that tried to merge all agent schemas, MultiAgentState:

  • Keeps each agent's schema independent
  • Projects state to agents as needed
  • Maintains type safety without complex merging

🏗️ State Management Patterns

1. Direct Field Updates (Recommended)

Agents with structured_output_model update container fields directly:

from pydantic import BaseModel

# Define structured outputs
class AnalysisResult(BaseModel):
    score: float
    findings: list[str]
    
class ReportResult(BaseModel):
    summary: str
    recommendations: list[str]

# Create agents with structured output
analyzer = SimpleAgentV3(
    name="analyzer",
    structured_output_model=AnalysisResult
)

reporter = SimpleAgentV3(
    name="reporter",
    structured_output_model=ReportResult
)

# Initialize state
state = MultiAgentState(agents=[analyzer, reporter])

# After analyzer runs, state has 'analyzer' field
# After reporter runs, state has 'reporter' field
# Both are typed and validated!

Read the full file on GitHub · 485 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 485 lines · 0 tokens per session scan A 5bb8b523b4fb

Subscribe to this mod's changes

multi_agent_state_guide_2025 is an agent published in the GitHub repository pr1m8/haive (23 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,819 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.