Runtime And Gateway
The gateway is the long-lived owner of Anyy work. It lets TUI, CLI, dashboard, cron, channels, and RPC clients use the same session runtime.
Runtime Assembly
Runtime assembly wires config, profile paths, repositories, provider runtime, tool registry, MCP runtime, skills resolver, channel registry, cron, heartbeat, dashboard, and RPC server.
Keep assembly code narrow. New dependencies should be injected into
gateway.Dependencies or the relevant runtime builder rather than imported by
the agent loop.
Gateway Service
internal/gateway.Service owns session creation, session.send, active-turn
tracking, toolset selection, context building, provider invocation, persistence,
event publication, and approval continuation.
It appends gateway-owned tools such as clarify, subagents, and role onboarding around the configured runtime tools.
Session Queue
When a session is busy, channel and RPC callers can enqueue input. Queue records live in state and are drained by the gateway when the active turn finishes.
Use the queue for same-session follow-up input. Use background jobs or subagents for independent work.
Background Jobs
Background jobs are session-scoped records. They represent async child agents, cron bridge output, workflows, or managed processes created by Anyy.
The gateway exposes job status, logs, wait, kill, and clear through RPC. Managed process tools are not a general host process inspector.
Notifications
Notifications and outbound messages flow through delivery/runtime helpers and
channel bindings. Tools such as notify_user and send_message are scoped to
the current user/origin, not arbitrary external contacts.
Lifecycle
Gateway lifecycle includes service start/stop, socket/TCP listener setup, channel reload, MCP reload, heartbeat ticks, cron scheduling, and dashboard sidecar management.
Use status, doctor, and subsystem-specific commands to verify lifecycle
behavior before changing runtime contracts.