Skip to main content

CLAIA Extensions Template

Project description

CLAIA Extension Template

A template and reference implementation for creating CLAIA extensions. This project demonstrates how to build custom agents, tools, and other plugins for the CLAIA framework.

Overview

This template provides a working example of a CLAIA extension with a simple demo agent. Use it as a starting point for creating your own CLAIA extensions, whether you're building custom agents, tools, architectures, or other plugin types.

Installation

From Source

# Clone the repository
git clone https://gitlab.com/exofox/claia/claia-template.git
cd claia-template

# Create virtual environment
python -m venv .venv
. .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -U pip
pip install -e .

From PyPI

pip install claia-template

Usage

After installation, the demo agent will be automatically registered in CLAIA.

Using the Demo Agent

# Start CLAIA with the demo agent
claia --default-agent demo

# Or switch to it in interactive mode
:agent demo

Creating Your Own Extension

1. Clone This Template

git clone https://gitlab.com/exofox/claia/claia-template.git my-extension
cd my-extension

2. Customize the Project

Update pyproject.toml:

[project]
name = "claia-my-extension"
description = "My custom CLAIA extension"
# ... update other metadata

[project.entry-points."claia.agents"]
my_agent = "my_module.agent:MyAgentPlugin"

3. Implement Your Plugin

Modify src/claia_agent/agent.py (or rename the module):

import pluggy
from typing import Type
from claia.lib import BaseAgent, Process
from claia.hooks import AgentInfo

hookimpl = pluggy.HookimplMarker("claia_agents")

class MyAgent(BaseAgent):
    @classmethod
    def process_request(cls, process, registry=None, **kwargs):
        # Your custom agent logic here
        model_id = process.parameters["model_id"]
        result = registry.run(model_id, process.conversation, **kwargs)
        
        if result.is_error():
            process.mark_failed(result.get_message())
        else:
            process.mark_completed(result.data)
        
        return process

class MyAgentPlugin:
    @hookimpl
    def get_agent_class(self, agent_name: str) -> Type[BaseAgent]:
        if agent_name.lower() == "my_agent":
            return MyAgent
        return None
    
    @hookimpl
    def get_agent_info(self) -> AgentInfo:
        return AgentInfo(
            name="my_agent",
            description="My custom agent",
            agent_class=MyAgent
        )

4. Install and Test

pip install -e .
claia --default-agent my_agent

Extension Types

CLAIA supports various extension types through different entry points:

  • claia.agents - Custom agent implementations
  • claia.tool_modules - Tool command modules
  • claia.architectures - Model architecture adapters
  • claia.deployments - Runtime backends
  • claia.solvers - Model selection strategies
  • claia.definitions - Model metadata and canonical IDs

Refer to the CLAIA documentation for details on each type.

Project Structure

claia-template/
├── src/
│   └── claia_agent/
│       ├── __main__.py
│       └── agent.py         # Demo agent implementation
├── pyproject.toml           # Project config & entry points
├── deploy.sh                # Deployment script
├── LICENSE
├── NOTICE
└── README.md

Building and Distribution

Build Wheel

pip install build
python -m build

# Or use the deploy script (will put whl under dist/whl/your-whl-file.whl)
./deploy --build-whl

This creates a wheel in dist/ that can be:

  • Uploaded to PyPI
  • Installed directly with pip install dist/*.whl
  • Distributed to users

Deploy Script

The included deploy.sh script can help automate building and deployment.

Related Projects

Support

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

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

claia_template-0.0.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

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

claia_template-0.0.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file claia_template-0.0.1.tar.gz.

File metadata

  • Download URL: claia_template-0.0.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for claia_template-0.0.1.tar.gz
Algorithm Hash digest
SHA256 50c5c4532d309341a509bc6988c84d9879fe22451cddf0d4e6cc25cefcc48725
MD5 1e691127cb8a2d379c5f25134381101e
BLAKE2b-256 82c63bd4302aa063d09569b0ba9491e2b4676ef35bfc9547d0850babf5deef3a

See more details on using hashes here.

File details

Details for the file claia_template-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: claia_template-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for claia_template-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a8a1179b6b62ef418f02823e50b7abb567319b08570ea0d5627be0c5cb9fd63
MD5 a12c75f09823a6487d6c5aff178ee7f6
BLAKE2b-256 4f9934e44999024f3dc3fcc5f3bb6ecd1c34ff33bcde3d6c5c956a96183db3c1

See more details on using hashes here.

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