Kortix AI Management System

repository·main·Indexed 12 days ago

https://github.com/kortix-ai/suna

An open-source AI Management System that treats agents, skills, and memory as version-controlled git repositories. It features an LLM Gateway for routing and failover, a CLI for project scaffolding and cloud deployment via `kortix ship`, and support for self-hosting on Docker or AWS EC2. The system allows developers to deploy agents in isolated cloud sandboxes with human-reviewed change requests.

Tokens
567.2K
Snippets
1.2K
Records
2.4K
Agent score
97%

What's inside Kortix

  1. Overview of the Production Web stack on ECS Fargate

    main

    The production web environment is hosted on AWS ECS Fargate. This stack manages the kortix-prod-web ECS service and the domain prod-fe-ecs.kortix.com.

    Key operational details:

    • Infrastructure: Runs two on-demand Fargate tasks across private subnets.
    • Scaling: Uses CPU and memory target tracking to scale the service from two to twelve tasks.
    • Reliability: Employs an ECS deployment circuit breaker to automatically roll back unhealthy task revisions.
    • Dependencies: Reads from the production VPC, subnets, and the kortix-prod-web-env secret.
    • State Management: Uses the remote state key prod/ecs-web.tfstate.

    Note on Deployment: This stack does not manage kortix.com. Vercel remains active during parallel validation, and production protection is disabled in the rendered web profile.

  2. Overview of the cost-anomaly-detection skill

    main

    The cost-anomaly-detection skill is a daily, reusable-session runbook designed to detect AWS cloud spend anomalies. It uses AWS Cost Explorer to maintain a per-service and per-account spend baseline. When spend exceeds a defined threshold, the skill attributes the likely driver (e.g., new resource, traffic surge, region shift) and posts an alert to a specified Slack channel.

    Key Characteristics:

    • Proactive & Scheduled: Designed to run via a daily cron job.
    • Read-Only: It only queries AWS Cost Explorer; it never modifies, deletes, or creates AWS resources or budgets.
    • Alert-Only: The primary output is a Slack message to {{alert_channel}}.
    • Stateful: It uses a durable ledger to maintain cumulative baselines and track known patterns.
  3. What is Kortix?

    main

    Kortix is an Autonomous Company Operating System designed as a cloud computer where a workforce of AI agents runs company operations. In Kortix, everything is managed as code that you own within your own git repository.

    The Core Workflow

    Kortix operates using a git-centric workflow to ensure safety and human oversight:

    1. Project: Your company is represented by a git repository containing a kortix.yaml manifest.
    2. Session: A session runs an agent inside an isolated sandbox on its own unique branch (e.g., <uuid>).
    3. Execution: The agent performs work, then commits and pushes changes to that branch.
    4. Review: The agent opens a change request (Pull Request). A human reviews the changes and merges them into the default branch to finalize the work.

    Manifest Versions

    • v2 Manifest: Used by new projects and utilizes the OpenCode REST API.
    • v1 Manifest: Maintained for backward compatibility with existing projects.
  4. Overview of the Staging Web stack on ECS Fargate

    main

    The kortix-staging-web stack manages the staging web environment using AWS ECS Fargate. It is hosted at staging-fe-ecs.kortix.com and is designed for parallel validation alongside Vercel.

    Key Infrastructure Details:

    • Service: kortix-staging-web ECS service.
    • Scaling: Starts with one on-demand Fargate task. It scales between one and four tasks based on CPU and memory target tracking.
    • Resiliency: Uses the ECS deployment circuit breaker to automatically roll back unhealthy task revisions.
    • Dependencies: Reads from the staging VPC, subnets, and the kortix-staging-web-env secret.
    • State Management: Uses the remote state key staging/ecs-web.tfstate.
  5. Overview of @kortix/sandbox-agent-server

    main

    The @kortix/sandbox-agent-server is a thin daemon that runs inside every Kortix project-session sandbox. It acts as a process supervisor, reverse proxy, and static web server to manage the sandbox environment.

    Core Responsibilities:

    • Process Supervision: Manages the opencode serve process.
    • Reverse Proxy: Fronts the opencode HTTP and SSE surface on KORTIX_SERVICE_PORT (default 8000).
    • System-Skill Injection: Injects managed Kortix system-skills into the OpenCode discovery directory.
    • Static Web Server: Serves HTML/assets written to disk on KORTIX_STATIC_PORT (default 3211). It injects a <base> tag to ensure relative assets resolve correctly through the sandbox proxy.
    • Control Surface: Provides health monitoring and repository refresh capabilities via specific HTTP routes.
  6. Overview of the ecs-api Terraform module

    main

    The ecs-api module deploys the kortix-api container as an autoscaling service on ECS Fargate behind an Application Load Balancer (ALB). It is designed to be used for both development and production environments by varying the input variables (e.g., increasing capacity and setting min_capacity >= 2 for production).

    Key Infrastructure Features:

    • Compute: ECS Fargate or Fargate Spot (via use_fargate_spot).
    • Networking: ALB in public subnets; tasks in private subnets with Security Group locks allowing traffic only from the ALB.
    • Security: HTTPS-only listener using a provided certificate_arn. No HTTP listener or redirects are exposed.
    • Autoscaling: Target-tracking based on both CPU (cpu_target) and memory (memory_target) between min_capacity and max_capacity.
    • Deployment: Rolling deployments with the ECS deployment circuit breaker enabled for automatic rollbacks on failed releases.
    • Observability: CloudWatch log group at /ecs/<name>.
    • Secrets: Injected via Secrets Manager or SSM ARNs using the secrets input; no hardcoded secrets.
  7. Understand the brand-mention-monitor skill

    main

    The brand-mention-monitor is a proactive, schedule-driven skill designed to monitor brand mentions across the open web (news, social platforms, and forums) without creating an alert firehose.

    Core Behavior:

    • Read-only: It performs public searches and fetches content without requiring logins or credentials.
    • Deduplication: It uses a local ledger (.kortix/memory/brand-monitor-log.md) to ensure it only reports new mentions.
    • Classification: It classifies mentions by sentiment (positive, neutral, negative) and flags 'notable' mentions (negative sentiment, high reach, influential sources, or factual errors).
    • Human-in-the-loop: For notable or negative mentions, it drafts a suggested response. It never posts, replies, or comments on external platforms; all suggested responses are delivered as drafts to a designated Slack channel for human review.
    • Output: It posts a single digest to a specified {{slack_channel}} containing a summary of routine mentions and detailed callouts for notable ones.
  8. Sandbox Mid-Session Stop Implementation Plan Overview

    main

    The Sandbox Mid-Session Stop plan aims to prevent the accidental termination of sandboxes that a user still legitimately owns, and to ensure that legitimate terminations are not reported as OpenCode crashes.

    Core Architecture Changes:

    • deadline_at remains the single source of truth for stopping sandboxes.
    • Implementation of control-plane-attested observations for three specific states:
      • Waiting on a human.
      • LLM-silent tool work.
      • A reopened session being read.
    • Every 'parked' sandbox must include a recorded reason.
    • The /start endpoint is designated as the owner of the 'wake' mechanism to prevent parallel health checks (503s) from being misread as terminal failures.

    Tech Stack:

    • API: Bun, Hono, Drizzle (apps/api)
    • Database: node-pg-migrate (packages/db)
    • Frontend/SDK: React, @kortix/sdk (packages/sdk, apps/web)
  9. Environment overview for the Kortix Sandbox

    main

    The Kortix Sandbox is an isolated Linux environment with the following characteristics:

    • User: The runtime user is kortix and has passwordless sudo access.
    • Workspace: The project repository and configuration are located at /workspace.
    • JavaScript/TypeScript: Use pnpm for dependencies and pnpm dlx for temporary package commands. Use Bun only if specifically required by a project.
    • Python: Python 3 is available via python or python3. Use uv for dependency management.
    • Path: Node.js, npm, pnpm, Python, uv, Bun, OpenCode, and the kortix CLI are all available on the PATH.
    • Browser: agent-browser and Chromium are installed for accessing local pages.
    • Other Tools: Git, curl, tmux, ffmpeg, LibreOffice, Pandoc, LaTeX, Poppler, qpdf, and Tesseract are pre-installed.
  10. Understand the Kortix deployment environments

    main

    Kortix uses different environments for development, testing, and production. Deployment targets vary between Amazon ECS Fargate and Vercel depending on the environment.

    EnvironmentSourceAPI URLFrontend URLVercel Status
    PreviewPR with preview labelpr-<number>.preview-api.kortix.compr-<number>.preview.kortix.com (ECS)Disabled
    Devmain branchdev-api.kortix.comdev.kortix.com (ECS)Disabled
    Stagingstaging branchstaging-api.kortix.comstaging-fe-ecs.kortix.com (ECS)staging.kortix.com
    Productionprod branchapi.kortix.comprod-fe-ecs.kortix.com (ECS)kortix.com

    Note: Dev and Preview environments are ECS-only. Staging and Production use parallel paths for ECS and Vercel.