Author Attribution Pattern

All agents use SDK with unique author field. Full granularity preserved.

Overview

The Author Attribution pattern gives every agent access to the SDK. All agents share the same Anima but differentiate their events using the author field. The Dreamer sees who said what during synthesis.

When to Use

  • Need sub-agent reasoning preserved in long-term memory
  • Multiple agents contribute to a shared conversation
  • Want full granularity without separate memory spaces

Architecture

┌──────────────┐  ┌──────────────┐  ┌──────────────┐
│ Orchestrator │  │  Researcher  │  │   Analyzer   │
│ author:      │  │ author:      │  │ author:      │
│ "orchestrator│  │ "researcher" │  │ "analyzer"   │
└──────┬───────┘  └──────┬───────┘  └──────┬───────┘
       │                 │                 │
       └─────────────────┼─────────────────┘
                         ▼
                 Shared Anima
              (all events tagged)

Code

from elephantasm import Elephantasm, EventType

# Shared client, shared Anima
client = Elephantasm(api_key="sk_live_...", anima_id="team-agent")

async def researcher_agent(query: str, session_id: str):
  # Sub-agent captures its own events with unique author
  client.extract(EventType.MESSAGE_OUT, f"Searching for: {query}",
                 session_id=session_id, role="assistant",
                 author="researcher")  # ← Key differentiator

  results = await search_documents(query)

  client.extract(EventType.MESSAGE_OUT, f"Found {len(results)} documents",
                 session_id=session_id, role="assistant",
                 author="researcher")
  return results

# What synthesis sees:
# [1] 10:30:01 | assistant (researcher): Searching for: AI memory
# [2] 10:30:02 | assistant (analyzer): Analyzing data...
# [3] 10:30:05 | assistant (researcher): Found 3 documents

Trade-offs

ProsCons
Full reasoning granularityHigher event volume
Shared memory across agentsConcurrent events may interleave
Simple setup (one Anima)No memory isolation between agents
Synthesis sees agent rolesRequires discipline in author naming

If concurrent agents cause confusing event ordering, consider Buffered Flush to control the sequence.