pip install cognitrix==0.4.6 Copy PIP instructions
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.
Cognitrix's architecture is designed to be highly modular and extensible:
More tools can be added by creating new classes that inherit from the Tool base class and specifying a unique category.
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:
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 --ui web Open your web browser and go to http://localhost:8000 to access the web UI.
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, _BASE_URL, _API_KEY, _MODEL):
cognitrix --provider openrouter To list created agents:
cognitrix tools -l To run Cognitrix with a specific provider:
cognitrix --provider To run Cognitrix with a specific agent:
cognitrix --agent 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 Second-model review of risky actions Tool calls that would normally ask for approval (deleting, overwriting a file, sending something out, shell commands) can be screened by a second model first. It answers allow (runs without asking), block (refused, and the agent is told why) or ask (you get the usual approval prompt). Errors, timeouts and unclear answers count as ask.
COGNITRIX_REVIEWER=unattended # off | unattended (task runs, auto mode) | always COGNITRIX_REVIEWER_PROVIDER=anthropic # defaults to AI_PROVIDER COGNITRIX_REVIEWER_MODEL=claude-haiku-5-5 COGNITRIX_REVIEWER_MAX_ALLOW=medium # high lets it allow deletes on its own too The reviewer never answers for tools you set to "Ask first" or for commands that need the full shell. Task runs record each verdict as an action_reviewed run event.
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.
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:
Install Dependencies: Navigate to the frontend directory and run:
pnpm install Start the Development Server: Run the following command to start the development server:
pnpm run dev Access the Development Server: Open your web browser and go to http://localhost:5173 to view the web UI in development mode.
docker-compose.yml runs three services: the web app (FastAPI + the in-process schedule loop), a dedicated worker (Celery, executes task/team runs), and Redis as the broker. Web and worker share the SQLite app database over a named volume.
cp .env.example .env # fill in provider keys + a JWT_SECRET_KEY docker compose up --build The UI is then at http://localhost:8000.
fly.toml deploys the single-container shape to Fly.io: one always-warm machine running a Supervisor-managed web process and solo Celery worker. Configure the external Redis connection with the CELERY_BROKER_URL and TASK_LIMIT_REDIS_URL Fly secrets. SQLite persistence lives on the mounted volume. Keep the web process to one machine while using SQLite because the volume is not shared and the schedule loop is per-process.
Cognitrix exposes an HTTP API for programmatic use by external apps, scripts, and automation platforms. Create an API key from the API Keys page in the web UI (or via POST /api/v1/api-keys with a session token). A key is shown once at creation — copy the key and its webhook signing secret then.
Send the key as Authorization: Bearer ctx_… or X-API-Key: ctx_…. Missing/invalid/revoked/expired credentials return 401; a valid key lacking a scope or allowlist entry returns 403.
curl -X POST http://localhost:8000/api/v1/agents/ /generate \ -H "Authorization: Bearer ctx_…" -H "Content-Type: application/json" \ -d '{"message": "Hello", "session_id": null}' # -> {"reply": "...", "session_id": "..."} (pass session_id back to continue) Add "stream": true for a Server-Sent-Events token stream (event: chunk … event: done).
Open a team and click Group chat to talk with all of its agents in one conversation (web and desktop):
Group chats run in the background like normal chats, so you can leave and come back. They use your signed-in session (/api/v1/teams/ /chats), not API keys.
Tasks can run themselves: one-shot ("at a time") or recurring (fixed interval or cron). Schedule fields ride the normal task payload:
# every 6 hours curl -X POST http://localhost:8000/api/v1/tasks \ -H "Authorization: Bearer ctx_…" -H "Content-Type: application/json" \ -d '{"title": "Nightly digest", "description": "Summarize new issues", "assigned_agents": [" "], "schedule_interval": 21600}' # weekdays at 9am (server-local time) # "schedule_cron": "0 9 * * 1-5" # once, at a specific time (any ISO datetime; offsets are normalized to UTC) # "schedule_at": "2026-08-01T09:00:00+02:00" At most one of schedule_at / schedule_interval (seconds, min 60) / schedule_cron may be set. Setting one arms the schedule (schedule_enabled defaults true); the response carries next_run_at (UTC). Pause/resume with POST /api/v1/tasks/ /schedule {"enabled": false} — resuming recomputes next_run_at.
Semantics: cron is evaluated in the server's local timezone; one-shot times are stored as UTC instants. If the server was down when a run was due, it fires once on startup (no backfill). If a run is still active when the next occurrence comes due, recurring schedules skip that occurrence; one-shots wait and fire when the run ends. Each fire creates a normal TaskRun, and the task's callback_url webhook applies. Scheduling via API key requires the run scope plus agent/team allowlists, same as starting a task directly.
Deliveries carry X-Cognitrix-Timestamp and X-Cognitrix-Signature: sha256= . The HMAC-SHA256 is computed over "{timestamp}.{raw_body}" with the key's webhook secret — recompute and compare in constant time, and reject stale timestamps:
import hmac, hashlib def verify(body: bytes, timestamp: str, signature: str, secret: str) -> bool: expected = "sha256=" + hmac.new( secret.encode(), f"{timestamp}.".encode() + body, hashlib.sha256 ).hexdigest() return hmac.compare_digest(expected, signature) By default webhook targets on loopback/private/link-local addresses are rejected (SSRF guard); set COGNITRIX_WEBHOOK_ALLOW_PRIVATE=1 to allow them in local/dev setups.
Point any OpenAI SDK at /v1 with your key as the API key:
from openai import OpenAI client = OpenAI(base_url="http://localhost:8000/v1", api_key="ctx_…") client.chat.completions.create( model="Assistant", # an agent name (see GET /v1/models) messages=[{"role": "user", "content": "Hello"}], ) Both blocking and stream=True are supported. Requires the chat scope.
Cognitrix is open source and contributions are welcome! Please refer to CONTRIBUTING.md for guidelines on how to contribute.
This project is licensed under the Apache License 2.0. See LICENSE for more information.
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.
Apache Software License, Other/Proprietary License (Apache2)
cognitrix ai agents ai agents ai-agents llms autonomous agents
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
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.
None of the files in this release were uploaded with provenance metadata.
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.




