Command Line Interface

The ainalyn CLI provides commands for validating and compiling agents.

Installation

The CLI is installed automatically with the SDK:

pip install ainalyn-sdk

Commands

validate

Validates an agent definition file.

ainalyn validate agent.py

Arguments:

  • file - Path to Python file containing an AgentDefinition

Example:

# agent.py
from ainalyn import AgentBuilder, WorkflowBuilder, NodeBuilder, PromptBuilder
 
prompt = PromptBuilder("my-prompt").description("Test").template("Hello").build()
workflow = (
    WorkflowBuilder("my-workflow")
    .description("Test")
    .add_node(NodeBuilder("node1").description("Node").uses_prompt("my-prompt").build())
    .entry_node("node1")
    .build()
)
 
agent = (
    AgentBuilder("my-agent")
    .version("1.0.0")
    .description("My agent")
    .add_prompt(prompt)
    .add_workflow(workflow)
    .build()
)
$ ainalyn validate agent.py
Validation successful

compile

Compiles an agent definition to YAML.

ainalyn compile agent.py -o output.yaml

Arguments:

  • file - Path to Python file
  • -o, --output - Output YAML file path (required)

Example:

$ ainalyn compile agent.py -o my_agent.yaml
Compiled successfully to my_agent.yaml

—version

Shows the SDK version.

ainalyn --version

Exit Codes

  • 0 - Success
  • 1 - Validation or compilation failed
  • 2 - File not found or invalid

Common Workflows

Validate before deploying:

ainalyn validate agent.py && echo "Ready to deploy!"

Compile multiple agents:

ainalyn compile agent1.py -o agent1.yaml
ainalyn compile agent2.py -o agent2.yaml