Skip to main content

CLI Overview

The Daita CLI provides a powerful, git-like interface for building, testing, and deploying AI agents. With simple commands and sensible defaults, you can go from idea to production quickly and efficiently.

Overview

The Daita CLI is designed around familiar git-like commands that make AI agent development feel natural for developers. Whether you're initializing a new project, creating agents, or deploying to the cloud, the CLI provides a consistent and intuitive interface.

Installation

Install the Daita CLI with all dependencies:

pip install daita-agents[cli]

Verify your installation:

daita --version
# Output: Daita CLI v0.1.0

Quick Start

Get started with a new project in under a minute:

# Create a new project
daita init my-agent --type analysis
cd my-agent

# Set your API key
export OPENAI_API_KEY="your-key-here"

# Create your first agent
daita create agent data_processor

# Test it locally
daita test

# Deploy to production (requires DAITA_API_KEY)
daita push

Command Structure

All Daita CLI commands follow a consistent pattern:

daita [GLOBAL_OPTIONS] COMMAND [ARGUMENTS] [COMMAND_OPTIONS]

Global Options

These options work with all commands:

OptionShortDescription
--verbose-vEnable detailed output for debugging
--quiet-qSuppress non-error messages
--help-hShow help information

Example usage:

daita --verbose test my_agent
daita -v push production --force

Core Commands

Project Management

  • init - Initialize new Daita projects
  • status - Check project and deployment status

Development

  • create - Generate agents, workflows, and components
  • test - Test agents and workflows with live reload

Deployment

  • push - Deploy to environments (git-like)
  • logs - View deployment logs and monitor

Utilities

  • utilities - Version information and documentation access

Environment Setup

Required Environment Variables

Configure these environment variables for full CLI functionality:

# LLM Provider Keys (choose your provider)
export OPENAI_API_KEY="sk-your-openai-key"
export ANTHROPIC_API_KEY="sk-ant-your-anthropic-key"
export GOOGLE_API_KEY="your-google-key"
export XAI_API_KEY="xai-your-grok-key"

# Daita Platform (for cloud deployment features)
export DAITA_API_KEY="your-daita-api-key"

Optional Configuration

Customize CLI behavior with these optional variables:

# API endpoint (usually not needed)
export DAITA_API_ENDPOINT="https://api.daita-tech.io"

# Log level
export DAITA_LOG_LEVEL="INFO" # DEBUG, INFO, WARNING, ERROR

Project Context

Most CLI commands require you to be inside a Daita project directory. A Daita project is identified by the presence of a .daita/ folder and daita-project.yaml configuration file.

Commands that require project context:

  • create - Create agents and workflows
  • test - Run tests locally
  • push - Deploy to cloud (requires DAITA_API_KEY)
  • status - Show project status
  • logs - View deployment logs (requires DAITA_API_KEY)
  • run - Execute agents/workflows remotely (requires DAITA_API_KEY)
  • deployments - Manage deployments (requires DAITA_API_KEY)
  • webhook - Webhook management (requires DAITA_API_KEY)

Commands that work anywhere:

  • init - Initialize new projects
  • version - Show version info
  • docs - Open documentation

If you run a project-context command outside a Daita project, you'll see:

❌ Not in a Daita project directory.
Run 'daita init' to create a new project.

Project Structure

A typical Daita project created by daita init looks like:

my-project/
├── .daita/ # Daita metadata and cache
│ ├── cache/ # Local cache files
│ └── deployments.json # Deployment history
├── agents/ # AI agent definitions
│ ├── __init__.py
│ └── example_agent.py
├── workflows/ # Multi-agent workflows
│ ├── __init__.py
│ └── example_workflow.py
├── data/ # Data files and samples
├── tests/ # Test files
│ ├── __init__.py
│ ├── test_agents.py
│ └── test_workflows.py
├── daita-project.yaml # Project configuration
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
└── README.md # Project documentation

Configuration File

The daita-project.yaml file controls your project settings:

name: my-project
version: 1.0.0
description: My AI agent project
created_at: '2025-01-15T10:00:00'

# Agent Definitions
agents:
- name: data_processor
display_name: "Data Processor"
type: substrate
created_at: '2025-01-15T10:00:00'

# Optional: Retry configuration
enable_retry: true
retry_policy:
max_retries: 3
base_delay: 1.0
max_delay: 60.0
strategy: exponential

# Workflow Definitions
workflows:
- name: data_pipeline
display_name: "Data Pipeline"
type: basic
created_at: '2025-01-15T10:00:00'

# Webhook Configuration (optional)
agents:
- name: github_agent
webhooks:
- slug: "github-push"
field_mapping:
"repository.name": "repo_name"
"commits[0].message": "commit_message"

# Schedule Configuration (optional)
schedules:
agents:
data_processor:
cron: "0 */6 * * *"
enabled: true
timezone: "UTC"

Common Workflows

Development Workflow

# 1. Start a new project
daita init my-project --type analysis
cd my-project

# 2. Create components
daita create agent data_processor
daita create workflow data_pipeline

# 3. Develop with live testing
daita test --watch

# 4. Test specific components
daita test data_processor

Deployment Workflow

# 1. Ensure tests pass locally
daita test

# 2. Check project status
daita status

# 3. Deploy to production (requires DAITA_API_KEY)
daita push

# 4. Monitor deployment
daita logs --follow

# 5. Execute agent remotely
daita run data_processor --data input.json

Debugging Workflow

# 1. Run tests with verbose output
daita test --verbose

# 2. Check detailed status
daita status --verbose

# 3. Examine logs
daita logs --lines 100

# 4. Test with custom data
daita test my_agent --data debug_data.json

# 5. View execution history
daita executions --limit 20

Error Handling

The CLI provides clear error messages and appropriate exit codes for automation:

Exit Codes

  • 0 - Success
  • 1 - General error
  • 2 - Invalid command usage
  • 3 - Project context error
  • 4 - Configuration error
  • 5 - Deployment error

Common Error Messages

Missing Dependencies:

❌ Missing CLI dependencies. Install with:
pip install PyYAML watchdog
Or install all CLI dependencies with:
pip install daita-agents[cli]

Invalid Project Configuration:

❌ Error: Invalid project configuration
Check your daita-project.yaml file for syntax errors

API Connection Issues:

❌ Failed to fetch deployments: Network error
Check your DAITA_API_KEY and network connection

Dependencies

The CLI requires these Python packages (installed automatically):

Core Dependencies

  • click - Command line interface framework
  • pydantic - Configuration validation
  • asyncio - Asynchronous operations

Optional Dependencies (CLI extras)

  • PyYAML - YAML configuration parsing
  • watchdog - File watching for development
  • aiohttp - HTTP client for API calls

Install all dependencies:

pip install daita-agents[cli]

Getting Help

Command Help

Get help for any command:

daita --help                    # General help
daita init --help # Command-specific help
daita create agent --help # Subcommand help

Verbose Output

Enable detailed output for debugging:

daita --verbose test my_agent
daita -v push production

Documentation

  • CLI Reference: Each command has detailed documentation
  • Online Docs: daita docs opens docs.daita-tech.io
  • Support: Get your DAITA_API_KEY at daita-tech.io

Next Steps

Tips and Best Practices

Development Tips

  1. Use watch mode: Develop with daita test --watch for immediate feedback
  2. Start small: Begin with basic agents before building complex workflows
  3. Test frequently: Run tests after each significant change
  4. Use verbose mode: Enable --verbose for debugging issues

Project Organization

  1. Clear naming: Use descriptive names for agents and workflows
  2. Modular design: Keep agents focused on single responsibilities
  3. Documentation: Document your agents and workflows thoroughly
  4. Version control: Use git for tracking changes and collaboration

Deployment Best Practices

  1. Test locally first: Always test with daita test before deploying
  2. Monitor deployments: Watch logs during and after deployment with daita logs --follow
  3. Use dry-run: Preview deployment changes with daita push --dry-run
  4. Track deployments: Review deployment history with daita deployments list

Troubleshooting

Common Issues

Command not found

# Ensure CLI is installed
pip install daita-agents[cli]

Permission denied

# Check file permissions
ls -la daita-project.yaml

API key issues

# Verify API key is set
echo $OPENAI_API_KEY

Getting Support

  • Documentation: Use daita docs for comprehensive guides
  • GitHub Issues: Report bugs and request features
  • Community: Join discussions and get support from other users