Skip to main content
The AgenticAI SDK provides a comprehensive command-line interface through run.py for the complete application lifecycle - from local development to production deployment.

Overview

The SDK CLI is a unified interface that handles:
  • Configuration: Select which environment config to use
  • Local Development: Start and test applications locally
  • Packaging: Create deployable KAR archives
  • Deployment: Deploy to the AgenticAI platform
  • Management: Create environments, check status, and test deployments

CLI Structure

What’s run.py?

run.py is a thin wrapper script that invokes the centralized CLI from agenticai_core.cli.runner. It provides a consistent interface across all workspace operations.

Command Format

Available Commands

Command Details

Config Command

Select which environment configuration file to use as the default.
Options:
  • -u, --use - Config name to use (for example, dev, staging, prod)
Example:
This copies .env/prod to .env/default, which is then loaded by subsequent commands.

Package Command

Package your application into a deployable KAR archive file.
Options:
  • -o, --output - Name for the output package (creates bin/<project_name>/)
Output:
  • bin/<project_name>/application.kar - Deployable ZIP archive (less than 1 MB target)
  • bin/<project_name>/application.config.json - Application configuration
Example:
Target package size is less than 1 MB. If larger, check contents with unzip -l bin/<project>/application.kar and ensure .venv isn’t included.

Start Command

Start the application server locally for development and testing.
Options:
  • -H, --host - Server host address (default: localhost)
  • -P, --port - Server port (default: 8080)
The flags use uppercase -H and -P because lowercase -h conflicts with argparse’s built-in help flag.
Example:

Deploy Command

Deploy your application to the AgenticAI platform.
Required Options:
  • -f, --kar - Path to KAR archive file
Optional:
  • -e, --env - Path to .env file to override app variables
  • --package-only - Re-deploys only the package; skips app import
Environment Requirements: Requires in .env/default (set via config command):
  • KORE_HOST - Platform endpoint URL
  • APP_API_KEY - API authentication key
Example:
Save the appId and streamId from deployment output for environment creation and testing.

Publish Command

Create an environment for your deployed application.
Required Options:
  • -a, --app - Application ID (from deploy output)
  • -n, --name - Environment name (for example, development, staging, production)
Optional:
  • -d, --desc - Environment description
  • -e, --env - Path to .env file to override app variables
Example:

Status Command

Check the status of a deployed application environment.
Required Options:
  • -a, --app - Application ID
  • -n, --name - Environment name
Example:

Undeploy Command

Undeploy an application environment.
Required Options:
  • -f, --path - Path to the deployment directory (for example, bin/myapp/)
Example:

Test Command

Run end-to-end tests on a deployed application.
Example:

Quick Reference

Complete reference for all run.py commands:

Environment Configuration

Create .env/<env> files with required variables:
Set configuration before running commands:

Application Lifecycle Workflow

Complete workflow from development to production:

Best Practices

  1. Development
    • Test locally with python run.py start before deploying
    • Use meaningful project names for packages
    • Keep package size minimal (less than 1 MB)
    • Always test with MCP client during development
  2. Deployment
    • Use .venv for virtual environments (excluded from packages)
    • Test in staging/dev before production
    • Save appId and streamId from deployment output immediately
    • Use separate .env files for different environments
    • Verify package contents with unzip -l if size is large
  3. Environment Management
    • Create separate environments for dev/staging/prod
    • Use descriptive environment names and descriptions
    • Document appId and environment names in your project README
    • Periodically check status with status command
  4. Monitoring
    • Enable distributed tracing in dev/staging environments
    • Monitor logs and performance metrics
    • Use status command to check environment health
    • Test deployments end-to-end before going live
  5. Configuration
    • Keep sensitive keys in .env files (never commit these!)
    • Use different API keys for different environments
    • Document required environment variables
    • Validate configuration before deployment

Troubleshooting

Package Size Issues

Deployment Failures

Module Import Errors

Related Resource