Skip to main content

Package for creating AI Agents using llms

Project description

Cognitrix

Cognitrix is an open-source autonomous AI agents orchestrator built in Python. It allows you to create and manage AI agents with ease and integrates seamlessly with large language models (LLMs) from various providers.

Features

  • Agent Creation and Management: Create, list, and load AI agents with customizable names, tasks, and configurations.
  • LLM Integration: Integrates with multiple LLM providers via OpenRouter (200+ models including OpenAI, Anthropic, Google, Meta, Mistral) plus local models via Ollama.
  • Modular Architecture: Easily extensible, allowing the addition of new tools, agents, and LLM integrations.
  • Conversational Interface: Interact with AI agents through a command-line interface, providing queries and receiving responses.
  • Tool Integration: Agents can utilize a variety of tools, including calculators, web searches, file system browsers, and more.
  • Autonomous Agent Mode: Agents can operate autonomously, visually perceiving the screen, interacting with UI elements, and performing tasks.
  • Multimodal Support: Handles both text and image inputs/outputs, enabling multimodal interactions.

Architecture

Cognitrix's architecture is designed to be highly modular and extensible:

  • Agents: The base Agent class is for creating and managing AI agents.
  • LLMs: Provider classes for OpenRouter (primary - 200+ models), OpenAI (direct), and Ollama (local).
  • Tools: A set of tools that agents can utilize. Each tool has a category attribute for grouping and management.
  • Templates: Customizable prompt templates guide the behavior and output formats of LLMs.

More tools can be added by creating new classes that inherit from the Tool base class and specifying a unique category.

Installation

Prerequisites

  • Python 3.11–3.13 (the package will not build on 3.10 or lower).
  • Node.js 18+ and a package manager (this repo uses pnpm) — only needed to build the web UI from source.
  • Poetry — only needed for building from source.
  • Redis — only needed if you use the background task API (Celery worker).

Install with pip:

pip install cognitrix

Build from source:

git clone https://github.com/theonlyamos/cognitrix.git
cd cognitrix/frontend
pnpm install
pnpm run build
cd ..
pip install .

Install directly from github:

pip install https://github.com/theonlyamos/cognitrix/archive/main.zip

Build the Docker Image:

git clone https://github.com/theonlyamos/cognitrix.git
cd cognitrix
docker build -t cognitrix .

Usage

Fill these environment variables as needed

OPENAI_API_KEY=
CO_API_KEY=
TAVILY_API_KEY=
CLARIFAI_ACCESS_TOKEN=
GROQ_API_KEY=
GOOGLE_API_KEY=
NEWSAPI_API_KEY=
ANTHROPIC_API_KEY=
DEEPGRAM_API_KEY=
MINDSDB_API_KEY=
BRAVE_SEARCH_API_KEY=
AIMLAPI_API_KEY=

To run Cognitrix with default settings:

cognitrix

Access the Web UI

To run with web interface

cognitrix --ui web

Open your web browser and go to http://localhost:8000 to access the web UI.

Run the Docker Container

After building the image, you can run the container with:

docker run -p 8000:8000 cognitrix

This command maps port 8000 of the container to port 8000 on your host machine.

To choose an LLM provider, pass --provider (config is read from the environment — AI_PROVIDER, <PROVIDER>_BASE_URL, <PROVIDER>_API_KEY, <PROVIDER>_MODEL):

cognitrix --provider openrouter

To list created agents:

cognitrix agents -l

To list available tools:

cognitrix tools -l

To run Cognitrix with a specific provider:

cognitrix --provider <provider_name>

To run Cognitrix with a specific agent:

cognitrix --agent <agent_name>

To run Cognitrix with a category of tools:

cognitrix --load-tools "web"

To run Cognitrix with categories of tools:

cognitrix --load-tools "web,general"

To create a new agent:

cognitrix agents --new

For more options and usage details, use the help command:

cognitrix --help

Web UI

Cognitrix includes a web UI built with React, TypeScript, and Vite. This UI allows users to interact with the AI agents and manage their configurations easily.

Development

For development purposes, you can also run the web UI locally without Docker. Ensure you have Node.js 18+ and pnpm installed, then follow these steps:

  1. Install Dependencies: Navigate to the frontend directory and run:

    pnpm install
    
  2. Start the Development Server: Run the following command to start the development server:

    pnpm run dev
    
  3. Access the Development Server: Open your web browser and go to http://localhost:5173 to view the web UI in development mode.

Contributing

Cognitrix is open source and contributions are welcome! Please refer to CONTRIBUTING.md for guidelines on how to contribute.

License

This project is licensed under the Apache License 2.0. See LICENSE for more information.

Acknowledgments

Cognitrix was created by Amos Amissah and is inspired by projects like AutoGPT and GPTEngineer. Special thanks to the open-source community and AI companies providing LLM APIs.

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

cognitrix-0.2.6.tar.gz (171.8 kB view details)

Uploaded Source

Built Distribution

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

cognitrix-0.2.6-py3-none-any.whl (227.1 kB view details)

Uploaded Python 3

File details

Details for the file cognitrix-0.2.6.tar.gz.

File metadata

  • Download URL: cognitrix-0.2.6.tar.gz
  • Upload date:
  • Size: 171.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for cognitrix-0.2.6.tar.gz
Algorithm Hash digest
SHA256 0e9863c5bfb019c7c67e6e53b1f98c7c8a2cc96bc70753c6f4b37af01ad9eda2
MD5 134ac704c8e933bb975075dc7ea74c65
BLAKE2b-256 b7b412d89818a02ae551243e56edb0baa8c281217759527ced4e289f2b80cbe4

See more details on using hashes here.

File details

Details for the file cognitrix-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: cognitrix-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 227.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for cognitrix-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2f824d6feef562df15c5ac1ff914550fde07a4b26e35c051d2200b5dd833c39e
MD5 96a6ed5a16aaba35dfc9600b366db1c6
BLAKE2b-256 e3243d31a2b99dc8f337543fad52e212361b361feb15a6d5cc6908d0891030f3

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