Skip to main content

Multi-Agent Behavior

How memory and knowledge work when you have multiple agents.

If you run more than one agent in CrabShack, it's important to understand how memory and the Knowledge Base are shared — and not shared — between them.

Memory Scopes​

Every memory has a scope that determines which agents can access it:

Universal Memories​

Universal memories are shared across all your agents. When one agent learns that "the company holiday party is on December 15th," every agent has access to that information.

Use universal scope for:

Type of InformationExample
Company-wide policies"All external communications must be approved by marketing"
Organizational facts"We have 50 employees across 3 offices"
Shared preferences"Reports should be delivered as PDF"
Industry knowledge"GDPR requires data breach notification within 72 hours"

Agent-Scoped Memories​

Agent-scoped memories belong to a single agent and are invisible to all other agents. These are useful for context that's specific to one agent's role.

Use agent scope for:

Type of InformationExample
Role-specific instructions"When greeting customers, always ask about their project first"
Agent-specific workflows"After resolving a ticket, tag it and notify the team channel"
Specialized knowledge"The staging API uses a different authentication token than production"
Experimental notes"Testing a new response format — revert if users complain"
tip

When in doubt, start with agent scope. If you later find that other agents need the same memory, you can promote it to universal. Going from universal to agent-scoped is harder — you'd need to delete the universal memory and recreate it as agent-scoped.

What Happens When You Delete an Agent​

When you delete an agent:

  • Agent-scoped memories are permanently deleted — they belonged to that agent and are no longer needed
  • Universal memories are preserved — they may have been created during that agent's sessions, but they're shared resources that other agents still use

This cleanup happens automatically. You don't need to manually manage memories when removing agents.

Knowledge Base Sharing​

The Knowledge Base is always shared across all agents. There is no agent-scoped knowledge base. If you upload a document, every agent can search and reference it.

This is usually the right behavior — reference documents like policies, guides, and procedures are typically relevant to all agents. If you need to restrict what documents an agent can access, consider creating separate CrabShack instances rather than trying to scope documents to individual agents.

How Context Injection Works Across Agents​

When an agent starts a conversation, it receives context from two pools:

  1. Universal memories — shared by all agents
  2. Its own agent-scoped memories — unique to this agent
  3. The full Knowledge Base — shared by all agents

The agent never sees another agent's scoped memories. This means agents can have specialized knowledge without it leaking into other agents' conversations.

Scenario

You have two agents: a Customer Support agent and a Sales agent. The Support agent has an agent-scoped memory: "When a customer mentions billing issues, escalate to the finance team." The Sales agent has its own: "Always mention the annual plan discount." Both agents share universal memories like "Our company was founded in 2019" and can search the same Knowledge Base documents. Neither agent sees the other's agent-scoped memories.