Skip to main content
Loss of provenance

A previous release had provenance metadata, but this release does not. View details.

Agenai

PyPI version Python 3.10+

A modular, extensible AI agent system built around a core loop of perceive -> reason -> act.

Features

  • Modular Architecture: Build specialized agents with custom tools
  • Multiple LLM Providers: Anthropic Claude, Ollama (local, free)
  • Web Interface: FastAPI backend with WebSocket chat
  • Built-in Agents: Teaching Assistant for teaching Python programming
  • Hooks System: Full observability into agent behavior

Installation

# From PyPI
pip install agenai

# With web server support (for chat UI)
pip install agenai[server]

# For development (editable install)
pip install -e ".[dev]"

Quick Start

Option 1: Using Ollama (Free, Local)

No API key required! Uses local LLMs.

# 1. Install Ollama from https://ollama.ai

# 2. Pull a model
ollama pull llama3.1

# 3. Start the web server
agenai-server

# 4. Open http://localhost:8000 in your browser

Option 2: Using Claude API

# Set your API key
export ANTHROPIC_API_KEY="your-key"

# Run CLI
agenai run "Explain Python for loops" -v

# Or interactive chat
agenai chat

Web Chat Interface

Start the server with WebSocket support:

# Install server dependencies
pip install -e ".[server]"

# Start server
agenai-server --port 8000

# Or with auto-reload for development
agenai-server --reload

Open http://localhost:8000 for the chat UI.

API Endpoints

Endpoint Method Description
/ GET Web chat interface
/health GET Health check + Ollama status
/chat POST REST chat endpoint
/ws/{client_id} WebSocket Real-time chat

Creating Custom Agents

from agenai.agent import SpecializedAgent, OllamaProvider
from agenai.agent.tools import Tool, ToolResult

class MyTool(Tool):
    @property
    def name(self) -> str:
        return "my_tool"

    @property
    def description(self) -> str:
        return "Does something useful"

    @property
    def parameters(self) -> dict:
        return {"type": "object", "properties": {}}

    def execute(self) -> ToolResult:
        return ToolResult.ok("Done!")

class MyAgent(SpecializedAgent):
    name = "my_agent"
    description = "My custom agent"

    def get_system_prompt(self) -> str:
        return "You are a helpful assistant..."

    def get_tools(self) -> list:
        return [MyTool()]

# Use with Ollama (free, local)
agent = MyAgent(llm=OllamaProvider(model="llama3.1"))
result = agent.run("Hello!")

Built-in Agents

Teaching Assistant

Teaching assistant for Python programming:

from agenai.agents.teaching_assistant import TeachingAssistantAgent

agent = TeachingAssistantAgent(difficulty_level="beginner")
result = agent.run("Explain what a for loop is")

Tools: run_code, review_code, create_exercise, create_quiz

Architecture

┌─────────────┐     WebSocket      ┌─────────────┐              ┌─────────────┐
│   Frontend  │ <================> │   Backend   │ <==========> │   Ollama    │
│  (Web Chat) │                    │  (FastAPI)  │              │ (Local LLM) │
└─────────────┘                    └──────┬──────┘              └─────────────┘
                                          │
                                          ▼
                                   ┌─────────────┐
                                   │   Agenai    │
                                   │   Agents    │
                                   └─────────────┘

See AI-AGENT-ARCHITECTURE.md for full details.

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Format code
ruff check --fix .

Publishing to PyPI

Local Publishing

# Build only
./scripts/publish.sh --build-only

# Publish to TestPyPI
TEST_PYPI_TOKEN=xxx ./scripts/publish.sh --test

# Publish to PyPI
PYPI_TOKEN=xxx ./scripts/publish.sh

Automated Publishing (GitHub Actions)

The repo includes a GitHub Actions workflow that auto-publishes using Trusted Publisher (OIDC - no API tokens needed).

How it works:

  • Create a GitHub Release → auto-publishes to PyPI
  • Manual dispatch → choose testpypi or pypi target

Step 1: Setup Trusted Publisher on PyPI

  1. Go to https://pypi.org/manage/project/agenai/settings/publishing/

  2. Click "Add a new publisher"

  3. Fill in:

    Field Value
    Owner tautobot
    Repository agenai
    Workflow name publish.yml
    Environment name pypi

Step 2: Setup Trusted Publisher on TestPyPI

  1. Go to https://test.pypi.org/manage/project/agenai/settings/publishing/
  2. Same fields as above, but Environment name: testpypi

Step 3: Setup GitHub Environments

  1. Go to https://github.com/tautobot/agenai/settings/environments
  2. Create environment pypi
  3. Create environment testpypi
  4. (Optional) Add protection rules like required reviewers

Releasing a New Version

  1. Update version in pyproject.toml
  2. Commit and push
  3. Create a GitHub Release with tag v0.x.x
  4. GitHub Actions auto-publishes to PyPI

License

MIT

Metadata

Release files for agenai 0.1.3

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

Loss of provenance

These files do not have provenance metadata, despite files in a prior release including this data.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for agenai 0.1.3
File Size Uploaded Provenance
agenai-0.1.3.tar.gz 60.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agenai 0.1.3
File Interpreter ABI Platform
agenai-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 117.7 kB

Release files / agenai-0.1.3.tar.gz

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL agenai-0.1.3.tar.gz
Size 60.7 kB
Tags Source
SHA-256 checksum
How to use checksums
21ff6a87e1dfba72565fd37c4fc9f114a4b5c78b966f9386bcddd24b94411c74
BLAKE2b-256 checksum
How to use checksums
c04f95cc2ef24886d23a10dcc46f156c5e1796f17b833f25788695f5d148cfbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / agenai-0.1.3-py3-none-any.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL agenai-0.1.3-py3-none-any.whl
Size 57.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e71f11f40f0e5d4d4a749cc923b6fe2275f2a569b6d5e92d6b7fa69dada96d1
BLAKE2b-256 checksum
How to use checksums
72f7a8a44a736253acbb71556b55ad273b74e9b5bd366481cffdd3444a96c3fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for agenai 0.1.3

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.

Loss of provenance

A previous release of these files had provenance metadata, but this release does not.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Release comparison

  • Removed 0.1.1 2 files With provenance
  • Added 0.1.3 2 files Without provenance

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.

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