> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Multi Agent Context Manager • Rust AI Agent SDK

> MultiAgentContextManager: Context manager for multi-agent scenarios.

# MultiAgentContextManager

> Defined in the [**context**](../modules/context) module.

<Badge color="orange">Rust AI Agent SDK</Badge>

Context manager for multi-agent scenarios.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph LR
    input["Input Data"] --> agent["Agent: MultiAgentContextManager"]
    agent --> output["Output Result"]
    style agent fill:#8B0000,color:#fff
    style input fill:#8B0000,color:#fff
    style output fill:#8B0000,color:#fff
```

## Fields

| Name              | Type                        | Description             |
| ----------------- | --------------------------- | ----------------------- |
| `managers`        | `HashMap&lt;String`         | Per-agent managers      |
| `shared_segments` | `Vec&lt;ContextSegment&gt;` | Shared context segments |

## Methods

### `new`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn new() -> Self
```

Create a new multi-agent context manager

### `register_agent`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn register_agent(&mut self, agent_id: impl Into<String>, config: ContextConfig) -> ()
```

Register an agent

**Parameters:**

| Name       | Type                      |
| ---------- | ------------------------- |
| `agent_id` | `impl Into&lt;String&gt;` |
| `config`   | `ContextConfig`           |

### `get`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn get(&self, agent_id: &str) -> Option<&ContextManager>
```

Get manager for an agent

**Parameters:**

| Name       | Type   |
| ---------- | ------ |
| `agent_id` | `&str` |

### `get_mut`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn get_mut(&mut self, agent_id: &str) -> Option<&mut ContextManager>
```

Get mutable manager for an agent

**Parameters:**

| Name       | Type   |
| ---------- | ------ |
| `agent_id` | `&str` |

### `add_shared`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn add_shared(&mut self, segment: ContextSegment) -> ()
```

Add shared segment

**Parameters:**

| Name      | Type             |
| --------- | ---------------- |
| `segment` | `ContextSegment` |

### `agent_ids`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn agent_ids(&self) -> Vec<&String>
```

Get all agent IDs

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/context/mod.rs#L505">
  `praisonai/src/context/mod.rs` at line 505
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Agent" icon="robot" href="/docs/rust/agent" />

  <Card title="Rust Overview" icon="book-open" href="/docs/rust/overview" />

  <Card title="Rust Quickstart" icon="rocket" href="/docs/rust/quickstart" />

  <Card title="Rust Installation" icon="download" href="/docs/rust/installation" />

  <Card title="Rust Autonomy" icon="wand-magic-sparkles" href="/docs/rust/autonomy" />
</CardGroup>
