Skip to main content

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.

Metadata

Release files for claia-template 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for claia-template 0.0.1
File Size Uploaded Provenance Actions
claia_template-0.0.1.tar.gz 8.3 kB Without provenance Details for claia_template-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for claia-template 0.0.1
File Interpreter ABI Platform Actions
claia_template-0.0.1-py3-none-any.whl Python 3 none any Details for claia_template-0.0.1-py3-none-any.whl

Total release size: 17.9 kB

Release files / claia_template-0.0.1.tar.gz

Download URL claia_template-0.0.1.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
50c5c4532d309341a509bc6988c84d9879fe22451cddf0d4e6cc25cefcc48725
BLAKE2b-256 checksum
How to use checksums
82c63bd4302aa063d09569b0ba9491e2b4676ef35bfc9547d0850babf5deef3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / claia_template-0.0.1-py3-none-any.whl

Download URL claia_template-0.0.1-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a8a1179b6b62ef418f02823e50b7abb567319b08570ea0d5627be0c5cb9fd63
BLAKE2b-256 checksum
How to use checksums
4f9934e44999024f3dc3fcc5f3bb6ecd1c34ff33bcde3d6c5c956a96183db3c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for claia-template 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page