Skip to content

Agent Server API

Port: 48915 (internal)

The agent server handles background task execution. It communicates with the main server through ZeroMQ sockets rather than HTTP.

ZeroMQ interface

SocketAddressTypeDirection
Session eventstcp://127.0.0.1:48961PUB/SUBMain → Agent
Task resultstcp://127.0.0.1:48962PUSH/PULLAgent → Main
Analyze queuetcp://127.0.0.1:48963PUSH/PULLMain → Agent

Message types

Main → Agent

Analyze request:

Published when the main server detects an actionable conversation context.

Agent → Main

Task result:

json
{
  "type": "task_result",
  "task_id": "uuid",
  "lanlan_name": "character_name",
  "result": { ... },
  "status": "completed"
}

Proactive message:

json
{
  "type": "proactive_message",
  "lanlan_name": "character_name",
  "text": "I found something interesting...",
  "source": "web_search"
}

Execution adapters

The agent server uses three adapters for task execution:

AdapterModuleCapabilities
MCP Clientbrain/mcp_client.pyExternal tool calls via Model Context Protocol
Computer Usebrain/computer_use.pyScreenshot analysis, mouse/keyboard automation
Browser Usebrain/browser_use_adapter.pyWeb browsing, form filling, content extraction

See Agent System for the detailed architecture.

Released under the MIT License.