How It Works
The real architecture: SkyKoi โ EC2 provisioner โ dedicated instance โ Agent Gateway โ Claude Opus 4.6 via Bedrock.
SkyKoi is an orchestration layer on top of a powerful Gateway architecture. Understanding the stack helps you get the most out of your agent.
The Stack
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SkyKoi Dashboard (Next.js 14) โ โ You interact here
โ Clerk Auth ยท Stripe Billing ยท RBAC โ
โ Hosted on Vercel โ
โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SkyKoi API
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ EC2 Provisioner โ
โ Launches t3.small ยท User-data script โ
โ IAM Instance Profile ยท Security Group โ
โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Dedicated EC2 Instance
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Ubuntu 22.04 (t3.small, us-east-1) โ
โ nginx (self-signed TLS, port 443) โ
โ โ reverse proxy to localhost:18789 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Koi Gateway (systemd) โ
โ skykoi-gateway.service โ
โ WebSocket API on port 18789 โ
โ Token-based auth โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Agent Runtime โ
โ Claude Opus 4.6 via AWS Bedrock โ
โ Model: amazon-bedrock/us.anthropic. โ
โ claude-opus-4-6-v1 โ
โ Tools: exec/read/write/browser/etc. โ
โ Workspace: /home/ubuntu/koi/ โ
โ Config: Koi agent configuration (Koi config) โ
โ Sessions: JSONL transcripts โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโThe Gateway
The Gateway is a single long-lived process that runs as a systemd service. It listens on port 18789 (localhost) and is reverse-proxied through nginx on port 443 with self-signed TLS. The Gateway exposes a typed WebSocket API, handles session routing, message queuing, and delivery.
The Gateway validates inbound frames against JSON Schema, emits events (agent, chat, presence, health, heartbeat, cron), and handles authentication via token-based auth.
The Agent Runtime
The Koi runs a single embedded agent runtime. The agent uses Claude Opus 4.6 via AWS Bedrock (amazon-bedrock/us.anthropic.claude-opus-4-6-v1) โ not the Anthropic API directly. The instance's IAM profile (skykoi-tenant-agent-profile) provides Bedrock access without API keys.
The agent has a workspace directory at /home/ubuntu/koi/ containing persona files (AGENTS.md, SOUL.md, USER.md, TOOLS.md, IDENTITY.md) and memory files. Sessions are stored as JSONL transcripts.
On each session start, the agent receives injected workspace files as context, then processes messages using Claude Opus 4.6 with full tool access. The agent can read/write files, execute shell commands, browse the web, search the internet, analyze images, generate speech, manage cron jobs, and spawn sub-agents.
Sessions
The agent runtime treats one direct-chat session per agent as primary. Direct chats collapse to agent:<agentId>:main, while group/channel chats get isolated keys. Sessions support daily reset (default 4:00 AM), idle reset, per-type overrides, and manual reset via /new or /reset.
Configuration
The Gateway reads JSON5 config from /home/ubuntu/.skykoi/skykoi.json with strict schema validation. Key config includes gateway.mode: "local", token-based auth, and the Bedrock model configuration. SkyKoi's config-generator.ts creates this config automatically during provisioning.
๐กSkyKoi generates the entire agent config, workspace files, and instance setup automatically via the EC2 user-data script. You never need to SSH in or edit config by hand.
