Favicon of AI Legion

AI Legion

A self-hosted AI agent framework in TypeScript with local memory, OpenAI cloud models and optional Google web search. Open source under MIT.

AI Legion is a self-hosted framework for developers who want several AI agents to work together on tasks. The program runs on your own machine through Node.js, while OpenAI's cloud models handle the language processing. It's open source under MIT.

You interact with the agents through a console, where each message reaches all active agents. Agents can take actions such as writing files, and Google Custom Search provides web search when connected to a Google Cloud account. Supported OpenAI models include GPT-4 and GPT-3.5 Turbo; the model registry also includes GPT-4.1. Model requests go to OpenAI, and web searches use Google's service, so this isn't an offline local LLM runner.

Each agent keeps its own memory, goals and notes on disk. That persistent state lets agents resume after a restart rather than begin a fresh session. Developers can also remove selected memory events and replay a point in an agent's work to investigate a failure. The TypeScript codebase supports a development loop in which an agent implements a feature, then tries it after the program restarts with the changed code.

The framework suits supervised experiments with cooperating agents and persistent task state. Agents can recover from action errors, but they can also get stuck repeating failed actions. GPT-3.5 Turbo is specifically prone to endless error loops, which can consume API tokens while the agent remains stuck.

Similar to AI Legion