feat(deploy): per-agent base_url and workspace_path routing

- AgentDefinition gains base_url and workspace_path fields (optional)
- load_agent_registry parses them from matrix-agents.yaml
- _build_platform_from_env uses agent.base_url per agent (falls back to AGENT_BASE_URL)
- _agent_workspace_root() resolves workspace per agent from registry
- _materialize_incoming_attachments saves files to agent workspace_path/incoming/
- send_outgoing accepts workspace_root param; reads outgoing files from agent workspace_path
- dispatch loop computes workspace_root from room agent_id and passes to _send_all
- config/matrix-agents.yaml and example updated with base_url and workspace_path
This commit is contained in:
Mikhail Putilovskij 2026-04-28 03:22:21 +03:00
parent d6b7720eca
commit 4bbae9affa
5 changed files with 108 additions and 21 deletions

View file

@ -1,15 +1,18 @@
# Agent registry for the Matrix bot.
#
# user_agents: maps a Matrix user ID to an agent ID.
# If a user is not listed here, the bot uses the first agent from the list below.
# If a user is not listed, the bot uses the first agent from the list below.
# Omit this section entirely for a single-agent setup.
#
# agents: list of available agents.
# id — must match the agent ID known to the platform (used as key in AgentApi connections)
# label — human-readable name (shown in logs)
#
# The agent HTTP endpoint is set globally via AGENT_BASE_URL env var (not per-agent here).
# File workspace paths are derived from SURFACES_WORKSPACE_DIR env var.
# id — must match the agent ID known to the platform
# label — human-readable name (shown in logs)
# base_url — HTTP/WS URL of this agent's endpoint
# (overrides the global AGENT_BASE_URL env var for this agent)
# workspace_path — absolute path to this agent's workspace directory inside the bot container
# (the bot saves incoming files here and reads outgoing files from here)
# Example: /agents/0 means the bot mounts the shared volume at /agents/
# and this agent's files live under /agents/0/
user_agents:
"@user0:matrix.example.org": agent-0
@ -18,5 +21,10 @@ user_agents:
agents:
- id: agent-0
label: "Agent 0"
base_url: "http://lambda.coredump.ru:7000/agent_0/"
workspace_path: "/agents/0"
- id: agent-1
label: "Agent 1"
base_url: "http://lambda.coredump.ru:7000/agent_1/"
workspace_path: "/agents/1"

View file

@ -4,3 +4,5 @@
agents:
- id: agent-1
label: Surface
base_url: "http://lambda.coredump.ru:7000/agent_1/"
workspace_path: "/agents/1"