Codegen SDK Documentation

repository·develop·Indexed 19 days ago

https://github.com/codegen-sh/codegen

A programmatic interface and Python API for AI software engineering agents. The SDK enables developers to automate coding tasks, feature implementations, and code analysis. It includes the Agent class for executing prompts, a Model Context Protocol (MCP) server for integration with Cline and Cursor, a specialized Codegen Git module for version control automation, and a REST API for retrieving detailed agent run logs.

Tokens
58.6K
Snippets
165
Records
344
Agent score
66%

What's inside Codegen SDK

  1. Overview of the Codegen MCP server

    develop

    The Codegen MCP server is an implementation of the Model Context Protocol (MCP) that provides tools and resources for interacting with the Codegen platform APIs. It is designed to enable AI agents to manage development workflows and access Codegen services directly through an MCP-compatible interface.

    Dependencies:

    • fastmcp
  2. Understand the Codegen Base Image environment

    develop

    Codegen sandboxes use a custom Docker image designed as a comprehensive development environment. It is optimized for full-stack and polyglot development, providing pre-configured runtimes, package managers, and system utilities.

    Core Runtimes:

    • Python 3.13 (via uv)
    • Node.js 22.14.0 (managed via NVM)

    Key Capabilities:

    • Multi-Language Support: Out-of-the-box support for Python and Node.js.
    • Package Management: Includes uv (Python), npm, yarn, pnpm (Node.js), and corepack.
    • Development Tools: git, gh (GitHub CLI), ripgrep, fd-find, tmux, and nginx.
    • Remote Access: Pre-configured SSH server for remote development.
  3. Understand Notion Integration capabilities

    develop

    The Notion integration allows Codegen agents to bridge the gap between planning and implementation by performing the following tasks:

    • Access workspace documentation: Read and analyze existing documentation, specs, and project requirements.
    • Update pages and databases: Modify content, add comments, and keep documentation current.
    • Sync development information: Connect planning documents directly to code implementation.
    • Generate knowledge base content: Create new documentation based on development work and insights.
  4. GitHub Integration Capabilities

    develop

    The GitHub integration enables Codegen to perform a full spectrum of agentic coding workflows, including:

    • Create and manage pull requests: Generate, update, and manage PRs with detailed descriptions and context.
    • Automated code reviews and feedback: Provide intelligent code analysis and suggestions.
    • Run checks and CI/CD workflows: Execute automated testing and deployment processes.
    • Sync repository changes: Keep repositories up-to-date and coordinate between branches.
  5. Capabilities of the Codegen CLI

    develop

    The codegen CLI provides a terminal-optimized version of the web UI and API capabilities, including:

    • Agent Management: List agent runs, check status, and view execution logs.
    • Work Retrieval: Pull branches and code changes created by agents to your local environment.
    • Agent Creation: Trigger new agent runs using custom prompts.
    • Claude Code Integration: Run Claude Code with OpenTelemetry monitoring and logging.
    • Organization Management: Switch between organizations and configure repositories.
    • Telemetry: Access traces and monitoring via MCP injection and web UI integration.
  6. Explore Codegen use cases

    develop

    Codegen agents are used across various development lifecycles, primarily for building new functionality, analyzing code, and maintaining systems. Based on usage data, the primary categories are:

    • Code Development & Implementation: Building full-stack applications (Next.js/React), implementing features, developing APIs (REST/GraphQL), and managing database schemas/migrations.
    • Code Review & Analysis: Performing PR reviews with inline suggestions, conducting codebase audits for security and performance, and reviewing system architecture.
    • Bug Fixes & Maintenance: Debugging complex stack issues, managing dependency updates, fixing build/deployment configurations, and optimizing performance.
    • Project Management & Documentation: Managing Linear tickets, creating READMEs and API docs, scoping features, and automating CI/CD workflows.
    • AI/ML & Specialized Tasks: Feature flag cleanup (e.g., Statsig), data analysis via SQL, and custom tooling development.

    Commonly used communication channels for triggering these tasks include Linear, Chat/API, Slack, and GitHub.

  7. Enterprise features for on-premises deployment

    develop

    Enterprise customers deploying Codegen on-premises receive additional support and features:

    • Priority Support: Dedicated channels and faster response times.
    • Custom Configuration: Tailored deployment plans for specific organizational requirements.
    • Security Integration: Compatibility with existing security tools and compliance policies.
    • Multi-Region Support: High-availability configurations across multiple clusters.
    • Air-gapped/Offline Support: Supported via special configuration.
    • Engineering Access: Direct access to the engineering team for deployment assistance and optimization reviews.
  8. Sentry integration capabilities and agent usage

    develop

    The Sentry integration allows Codegen agents to interact with your error tracking data to accelerate production problem resolution.

    Capabilities

    • Automated root cause analysis: Analyzing error patterns and stack traces.
    • Error investigation: Deep diving into error contexts, user impact, and code changes.
    • Issue prioritization: Identifying critical errors.
    • Performance monitoring: Analyzing application bottlenecks.
    • Release tracking: Connecting errors to specific deployments.
    • Team coordination: Assigning issues based on expertise.

    How Agents Use Sentry

    Agents use the integration to examine stack traces, generate resolution recommendations, update issue statuses, and link error fixes to GitHub PRs and code changes.

  9. Understand Figma integration capabilities

    develop

    The Figma integration enables several design-to-code workflows:

    • Access design specifications: Read design files, components, and detailed specifications.
    • Extract design assets: Pull images, icons, and visual elements for implementation.
    • Convert designs to code: Transform design mockups into functional frontend code.
    • Sync design changes: Stay updated with design iterations and modifications.