home / skills / letta-ai / letta-code / messaging-agents

messaging-agents skill

/src/skills/builtin/messaging-agents

This skill enables you to message other agents on the Letta server to query knowledge, coordinate tasks, and share information.

npx playbooks add skill letta-ai/letta-code --skill messaging-agents

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
4.6 KB
---
name: messaging-agents
description: Send messages to other agents on your server. Use when you need to communicate with, query, or delegate tasks to another agent.
---

# Messaging Agents

This skill enables you to send messages to other agents on the same Letta server using the thread-safe conversations API.

## When to Use This Skill

- You need to ask another agent a question
- You want to query an agent that has specialized knowledge
- You need information that another agent has in their memory
- You want to coordinate with another agent on a task

## What the Target Agent Can and Cannot Do

**The target agent CANNOT:**
- Access your local environment (read/write files in your codebase)
- Execute shell commands on your machine
- Use your tools (Bash, Read, Write, Edit, etc.)

**The target agent CAN:**
- Use their own tools (whatever they have configured)
- Access their own memory blocks
- Make API calls if they have web/API tools
- Search the web if they have web search tools
- Respond with information from their knowledge/memory

**Important:** This skill is for *communication* with other agents, not *delegation* of local work. The target agent runs in their own environment and cannot interact with your codebase.

**Need local access?** If you need the target agent to access your local environment (read/write files, run commands), use the Task tool instead to deploy them as a subagent:
```typescript
Task({
  agent_id: "agent-xxx",           // Deploy this existing agent
  subagent_type: "explore",        // "explore" = read-only, "general-purpose" = read-write
  prompt: "Look at the code in src/ and tell me about the architecture"
})
```
This gives the agent access to your codebase while running as a subagent.

## Finding an Agent to Message

If you don't have a specific agent ID, use these skills to find one:

### By Name or Tags
Load the `finding-agents` skill to search for agents:
```bash
letta agents list --query "agent-name"
letta agents list --tags "origin:letta-code"
```

### By Topic They Discussed
Load the `searching-messages` skill to find which agent worked on something:
```bash
letta messages search --query "topic" --all-agents
```
Results include `agent_id` for each matching message.

## CLI Usage (agent-to-agent)

### Starting a New Conversation

```bash
letta -p --from-agent $LETTA_AGENT_ID --agent <id> "message text"
```

**Arguments:**
| Arg | Required | Description |
|-----|----------|-------------|
| `--agent <id>` | Yes | Target agent ID to message |
| `--from-agent <id>` | Yes | Sender agent ID (injects agent-to-agent system reminder) |
| `"message text"` | Yes | Message body (positional after flags) |

**Example:**
```bash
letta -p --from-agent $LETTA_AGENT_ID \
  --agent agent-abc123 \
  "What do you know about the authentication system?"
```

**Response:**
```json
{
  "conversation_id": "conversation-xyz789",
  "response": "The authentication system uses JWT tokens...",
  "agent_id": "agent-abc123",
  "agent_name": "BackendExpert"
}
```

### Continuing a Conversation

```bash
letta -p --from-agent $LETTA_AGENT_ID --conversation <id> "message text"
```

**Arguments:**
| Arg | Required | Description |
|-----|----------|-------------|
| `--conversation <id>` | Yes | Existing conversation ID |
| `--from-agent <id>` | Yes | Sender agent ID (injects agent-to-agent system reminder) |
| `"message text"` | Yes | Follow-up message (positional after flags) |

**Example:**
```bash
letta -p --from-agent $LETTA_AGENT_ID \
  --conversation conversation-xyz789 \
  "Can you explain more about the token refresh flow?"
```

## Understanding the Response

- Scripts return only the **final assistant message** (not tool calls or reasoning)
- The target agent may use tools, think, and reason - but you only see their final response
- To see the full conversation transcript (including tool calls), use the `searching-messages` skill with `letta messages list --agent <id>` targeting the other agent

## How It Works

When you send a message, the target agent receives it with a system reminder:
```
<system-reminder>
This message is from "YourAgentName" (agent ID: agent-xxx), an agent currently running inside the Letta Code CLI (docs.letta.com/letta-code).
The sender will only see the final message you generate (not tool calls or reasoning).
If you need to share detailed information, include it in your response text.
</system-reminder>
```

This helps the target agent understand the context and format their response appropriately.

## Related Skills

- **finding-agents**: Find agents by name, tags, or fuzzy search
- **searching-messages**: Search past messages across agents, or view full conversation transcripts

Overview

This skill lets you send messages to other agents on the same Letta server to communicate, query, or coordinate. Use it when you need answers from an agent with specialized knowledge or want to consult another agent's memory. It focuses on inter-agent messaging only and does not grant the target agent local access to your environment.

How this skill works

Messages are delivered through a thread-safe conversations API and the target agent receives a system reminder identifying the sender. The caller sees only the target agent's final assistant message (no tool call traces or internal reasoning). For full transcripts or tool activity, use the message-searching utilities to list conversation history for that agent.

When to use it

  • Ask another agent a direct question about a domain they specialize in.
  • Query an agent for information stored in their memory blocks.
  • Coordinate or discuss a task with a separate agent running on the server.
  • Quickly get a second opinion without deploying a subagent with local access.
  • Follow up in an existing conversation to continue context-specific dialogue.

Best practices

  • Always include the sender agent ID when issuing a message so the recipient gets the context reminder.
  • Keep messages focused and include necessary context in the message body because only the final response is returned.
  • If the recipient needs access to your codebase or files, deploy them as a subagent via the Task tool instead.
  • Use agent discovery (by name, tags, or message search) to find the correct target agent before messaging.

Example use cases

  • Ask a BackendExpert agent about authentication design decisions and token flows.
  • Query a documentation agent for the location of API docs or design notes stored in their memory.
  • Request a specialized agent to summarize recent technical discussions it participated in.
  • Ping a QA agent to get a quick checklist or test case suggestions for a feature.
  • Continue a previous conversation by referencing the conversation ID to maintain context.

FAQ

Can the target agent run commands or modify my local files?

No. Target agents cannot access your local environment or run shell commands. Use the Task tool to deploy a subagent if local access is required.

Do I receive the target agent's tool calls and internal reasoning?

No. The messaging API returns only the final assistant message. To inspect tool calls or a full transcript, use the message search/listing tools for that agent.