AutoChain
AutoChain is a lightweight and extensible framework for building custom generative agents using LLMs with custom tools. It simplifies agent customization and provides automated multi-turn conversation evaluation with simulated users, addressing the challenges of manual testing and regression. It is designed for developers who want to rapidly iterate on generative agents.
✨ Key features
- Lightweight and extensible generative agent pipeline
- Supports custom tools and OpenAI function calling
- Simple memory tracking for conversation history and tool outputs
- Automated multi-turn conversation evaluation with simulated conversations
- Easy prompt updates and verbose output for debugging
- Minimal abstraction layers compared to other frameworks
🎯 Use cases
- Build custom conversational agents with specific tools
- Evaluate agent behavior across multiple user scenarios automatically
- Rapidly prototype and iterate on agent prompts and tools
- Simulate conversations with test users to verify outcomes
📦 Installation
🧰 Requirements: Python 3.10.11, OpenAI API key, and optionally pyenv for source install.
pip install autochain
Or install from source after cloning this repository
cd autochain
pyenv virtualenv 3.10.11 venv
pyenv local venv
pip install .
Set PYTHONPATH and OPENAI_API_KEY
export OPENAI_API_KEY=
export PYTHONPATH=`pwd`
🚀 Usage
from autochain.chain.chain import Chain
from autochain.memory.buffer_memory import BufferMemory
from autochain.models.chat_openai import ChatOpenAI
from autochain.agent.conversational_agent.conversational_agent import ConversationalAgent
llm = ChatOpenAI(temperature=0)
memory = BufferMemory()
agent = ConversationalAgent.from_llm_and_tools(llm=llm)
chain = Chain(agent=agent, memory=memory)
print(chain.run("Write me a poem about AI")['message'])
❓ FAQ
How does AutoChain compare to LangChain?
AutoChain takes inspiration from LangChain and shares similar but simpler concepts, with up to 2 layers of abstraction to enable rapid iteration.
Can I use custom tools with AutoChain?
Yes, you can add a list of custom tools to the agent using the Tool interface, and it also supports OpenAI function calling.
How does AutoChain evaluate agents?
It provides a workflow evaluation framework that runs conversations between the agent and LLM-simulated test users, then uses LLMs to evaluate if the conversation achieved the intended outcome.
How do I run workflow evaluations?
You can run test cases interactively with the -i flag or run the full suite by executing the test file, e.g., python autochain/workflows_evaluation/conversational_agent_eval/generate_ads_test.py.
📊 Repository
🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.