Skip to main content

Agent Management

Agents are the core identity in MEMANTO. Each agent maintains its own memory namespace and sessions.

What is an Agent?

An agent represents a persistent identity that can maintain memories across sessions:
  • Unique identifier - Never changes (e.g., customer-support-bot)
  • Memory namespace - Isolated from other agents
  • Multiple sessions - Can have sessions at different times
  • Long-term context - Memories persist across sessions

Agent Lifecycle

Create Agent → Activate Session → Store/Recall Memories → Deactivate Session → Reactivate Later

Creating Agents

CLI Method

Create an agent:
memanto agent create customer-support
Output:
Agent 'customer-support' created successfully
Agent ID: customer-support
Namespace: memanto_agent_customer-support
Create with a description:
memanto agent create project-manager --description "Tracks project decisions"

REST API Method

import httpx

response = httpx.post(
    "http://localhost:8000/api/v2/agents",
    json={"agent_id": "analytics-bot"},
    headers={"Authorization": f"Bearer {api_key}"}
)
agent = response.json()
print(f"Created agent: {agent['agent_id']}")

Listing Agents

View all agents you’ve created:
memanto agent list
Output:
Available Agents:

1. customer-support
   Created: 2025-03-25 10:30:00 UTC
   Memories: 42
   Last Active: 2025-03-30 14:22:00 UTC

2. project-manager
   Created: 2025-03-20 09:15:00 UTC
   Memories: 18
   Last Active: 2025-03-28 11:45:00 UTC

REST API

response = httpx.get(
    "http://localhost:8000/api/v2/agents",
    headers={"Authorization": f"Bearer {api_key}"}
)
agents = response.json()["agents"]
for agent in agents:
    print(f"{agent['agent_id']}: {agent['memory_count']} memories")

Agent Sessions

Understanding Sessions

A session is a 6-hour window where an agent is active:
  • Session Token - Cryptographically signed JWT
  • 6-hour duration - Expires after 6 hours of creation
  • Can be extended - Keep agent active longer
  • Auto-renewal - Can renew automatically on expiry

Activate Session

Start a new session for an agent:
memanto agent activate customer-support
Output:
Session activated for agent 'customer-support'
Session ID: session_abc123xyz
Session Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Expires At: 2025-03-30 22:30:00 UTC
The session token is automatically saved to ~/.memanto/config.json.

Check Active Session

memanto session info
Output:
Current Session Information:

Agent ID:        customer-support
Session ID:      session_abc123xyz
Session Token:   eyJhbGc... (truncated)
Created At:      2025-03-30 16:30:00 UTC
Expires At:      2025-03-30 22:30:00 UTC
Time Until Expiry: 6h 5m

Extend Session

Keep an agent active longer:
memanto session extend --hours 6
Output:
Session extended successfully
New expiry time: 2025-03-31 04:30:00 UTC
Or extend via API:
response = httpx.post(
    "http://localhost:8000/api/v2/session/extend",
    params={"extend_hours": 6},
    headers={
        "Authorization": f"Bearer {api_key}",
        "X-Session-Token": session_token
    }
)
data = response.json()
print(f"New expiry: {data['expires_at']}")

Deactivate Session

End the current session:
memanto agent deactivate
Output:
Session deactivated for agent 'customer-support'
The agent still exists; you just need to activate a new session to use it again.

Agent Metadata

View Agent Metadata

memanto agent bootstrap customer-support
This shows:
  • Agent ID
  • Created timestamp
  • Memory count by type
  • Last session info
  • Summary of important memories
Output:
Agent Metadata: customer-support

Created: 2025-03-25 10:30:00 UTC
Total Memories: 42

Memory Breakdown:
├── facts: 15
├── preferences: 8
├── events: 12
├── commitments: 4
└── decisions: 3

Last Session: 2025-03-30 14:22:00 UTC
Last Memory: 2025-03-30 14:45:00 UTC (event)

Sample Memories:
- Customer Alice Johnson (fact)
- Alice prefers email contact (preference)
- Ticket #12345 resolved (event)

Multi-Agent Patterns

Support Team (Multiple Agents per Team)

Each support representative has their own agent:
# Each rep has persistent memory
memanto agent create alice-support-rep
memanto agent create bob-support-rep
memanto agent create charlie-support-rep
Each rep’s agent maintains independent memory of their customer interactions.

Specialized Agents

Different agents for different functions:
memanto agent create customer-preferences
memanto agent create project-decisions
memanto agent create billing-issues
memanto agent create technical-support
Each specializes in one domain.

Testing & Development

Separate agents for testing:
memanto agent create prod-bot      # Production
memanto agent create staging-bot   # Staging
memanto agent create dev-bot       # Development
Each has independent test data.

Agent Scaling

Naming Convention

Use clear, descriptive names:
# Good
memanto agent create customer-support-v2
memanto agent create order-tracking-bot
memanto agent create financial-advisor

# Avoid
memanto agent create bot1
memanto agent create agent
memanto agent create temp-test-123

Organization Strategy

- production
  ├── customer-support
  ├── billing-bot
  └── technical-support
- staging
  ├── customer-support-staging
  ├── billing-bot-staging
  └── technical-support-staging
- testing
  ├── customer-support-test
  ├── billing-bot-test
  └── technical-support-test

Performance Considerations

Agent Limits

  • No hard limit on number of agents (free tier up to 5 agents)
  • Each agent can have unlimited memories
  • Sessions limited to 1 active per agent at a time
  • Memories queryable in under 100ms on average

Optimization Tips

  1. Reuse agent sessions - Don’t create new sessions frequently if active session is available
  2. Batch operations - Store multiple memories at once
  3. Deactivate sessions - Deactivate sessions when no longer needed to free resources

Memory Count by Agent

Check memory usage:
memanto agent bootstrap {agent_id}

Next Steps


Agents are the foundation of MEMANTO. Master agent management to build powerful memory-enabled applications!