Skip to main content

Agent Definition Compiler for Ainalyn Platform

Project description

Ainalyn SDK

Python 3.11+ License: MIT PyPI Tests

Official Python SDK for building task-oriented agents on Ainalyn Platform

Build, validate, and deploy AI agents with type-safe Python builders and automatic runtime handling.


🚀 Quick Start

Installation

pip install ainalyn-sdk

Your First Agent (30 seconds)

from ainalyn import AgentBuilder, ModuleBuilder, WorkflowBuilder, NodeBuilder

# Define your agent
agent = (
    AgentBuilder("my-agent")
    .version("1.0.0")
    .description("My first task-oriented agent")
    .add_module(
        ModuleBuilder("greeter")
        .description("Greets users")
        .input_schema({"type": "object", "properties": {"name": {"type": "string"}}})
        .output_schema({"type": "object", "properties": {"greeting": {"type": "string"}}})
        .build()
    )
    .add_workflow(
        WorkflowBuilder("main")
        .description("Main workflow")
        .add_node(
            NodeBuilder("greet")
            .description("Greet user")
            .uses_module("greeter")
            .build()
        )
        .entry_node("greet")
        .build()
    )
    .build()
)

# Compile to YAML
from ainalyn import compile_agent
yaml_output = compile_agent(agent)
print(yaml_output)

💡 What is Ainalyn SDK?

Ainalyn SDK enables developers to create task-oriented agents with two approaches:

📊 COMPOSITE Agents (Graph-First)

  • Build workflows using node-based graphs
  • Pure configuration - no code required
  • Platform executes your workflow
  • Perfect for: Data pipelines, orchestration, multi-step processes

💻 ATOMIC Agents (Code-First)

  • Write Python functions with custom logic
  • Full implementation control
  • Deploy as AWS Lambda functions
  • Perfect for: Custom algorithms, API integrations, data transformations

🎯 Key Features

Type-Safe Builders - Full IDE autocomplete and compile-time validation ✅ Comprehensive Validation - Schema, static analysis, platform compliance checks ✅ Runtime Wrapper - SYNC/ASYNC execution modes with automatic routing ✅ CLI Tools - Validate and compile from command line ✅ Production Ready - 175 tests, >85% coverage, strict type checking


📖 Core Concepts

Agent Definition Structure

AgentDefinition
├── Metadata (name, version, description)
├── Modules (reusable components)
├── Prompts (LLM prompt templates)
├── Tools (external integrations)
└── Workflows (execution graphs)
    └── Nodes (workflow steps)

Execution Modes

  • SYNC Mode: Fast tasks (<29s) - immediate response
  • ASYNC Mode: Long tasks (>29s) - polling-based with state management

Platform Review Gates

The SDK validates against 5 platform compliance gates:

  1. Contract Completeness - All schemas defined
  2. No Shadow Runtime - Clear ATOMIC vs COMPOSITE distinction
  3. No Billing Authority - Pricing is hint-only
  4. EIP Dependencies - Valid dependency declarations

🛠️ Development Paths

Path 1: COMPOSITE Agent (Graph-First)

from ainalyn import AgentBuilder, ModuleBuilder, WorkflowBuilder, NodeBuilder

agent = (
    AgentBuilder("data-pipeline")
    .version("1.0.0")
    .description("Multi-step data processing pipeline")
    .add_module(...)  # Define reusable modules
    .add_workflow(
        WorkflowBuilder("main")
        .add_node(NodeBuilder("fetch").uses_module("http-fetcher").build())
        .add_node(NodeBuilder("process").uses_module("data-processor").build())
        .add_node(NodeBuilder("save").uses_module("data-saver").build())
        .entry_node("fetch")
        .build()
    )
    .build()
)

# Compile and submit to platform
from ainalyn import compile_agent
yaml_output = compile_agent(agent)

Path 2: ATOMIC Agent (Code-First)

from ainalyn.runtime import agent, ExecutionContext

@agent.atomic
def my_handler(context: ExecutionContext) -> dict:
    """Your custom business logic here"""
    user_input = context.input_data

    # Your implementation
    result = process_data(user_input)

    return {"output": result}

# Define agent metadata separately
from ainalyn import AgentBuilder
definition = (
    AgentBuilder("my-atomic-agent")
    .version("1.0.0")
    .description("Custom Python agent")
    .build()
)

Deploy to AWS Lambda and the runtime handles SYNC/ASYNC routing automatically.


📚 Examples

Explore complete examples in our repository:


🔧 CLI Reference

# Validate agent definition
ainalyn validate my_agent.py

# Compile to YAML
ainalyn compile my_agent.py -o agent.yaml

# Run validation with verbose output
ainalyn validate my_agent.py --verbose

🐛 Troubleshooting

Common Issues

ImportError: No module named 'ainalyn'

pip install ainalyn-sdk

ValidationError: Missing required field

  • Ensure all required fields are set in builders
  • Check that description(), version(), etc. are called

ReferenceError: Module 'xyz' not found

  • Verify module names match exactly
  • Check that referenced modules are added to agent

For more help, see our GitHub Issues.


📖 Documentation


🤝 Contributing

We welcome contributions! See our Contributing Guide for:

  • Development setup
  • Code style guidelines
  • Testing requirements
  • Pull request process

📄 License

MIT License - See LICENSE file for details.


📝 Changelog

See CHANGELOG.md for version history and release notes.


🆘 Support


Built with ❤️ by the CoreNovus Team

WebsitePlatformBlog

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ainalyn_sdk-0.2.0a2.tar.gz (95.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ainalyn_sdk-0.2.0a2-py3-none-any.whl (117.6 kB view details)

Uploaded Python 3

File details

Details for the file ainalyn_sdk-0.2.0a2.tar.gz.

File metadata

  • Download URL: ainalyn_sdk-0.2.0a2.tar.gz
  • Upload date:
  • Size: 95.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ainalyn_sdk-0.2.0a2.tar.gz
Algorithm Hash digest
SHA256 1fff1eb9ff6cf39476520d80f821e47a286a2972ef28ba8e4865a627b75b4818
MD5 426a0c32c7f18eeb7439e7db9d417fcf
BLAKE2b-256 3237c98da7c954b6aa3f7cd0ab18b30128ab412c41c9e92fe9fac7dc4316e1f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ainalyn_sdk-0.2.0a2.tar.gz:

Publisher: release.yml on CoreNovus/ainalyn-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ainalyn_sdk-0.2.0a2-py3-none-any.whl.

File metadata

  • Download URL: ainalyn_sdk-0.2.0a2-py3-none-any.whl
  • Upload date:
  • Size: 117.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ainalyn_sdk-0.2.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 e182c9657324a121b3f6297cd8b0a53465db518f4679a15625f2fa6188a8b05b
MD5 d66816a1c6aa2d0e2b2d3e295b74f6a1
BLAKE2b-256 927cb7674325d890e59719d92f799c6906424a90118097735f681ebb71d464a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ainalyn_sdk-0.2.0a2-py3-none-any.whl:

Publisher: release.yml on CoreNovus/ainalyn-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page