Skip to main content

A framework for programming stateful LLM based chatbots.

Project description

AutoGRAMS

AutoGRAMS (Autonomous Graphical Agent Modeling Software) is a Python library that represents chatbots as stateful, continuously running programs. Unlike traditional chatbots, which often treat conversation turns as isolated events, AutoGRAMS allows agents to function as dynamic programs that retain their full execution state, including variables and control flow, across conversation turns.

By representing a chatbot as a running program, AutoGRAMS enables precise control over dialogue flow. Decisions made during conversations directly influence the program’s execution path, variables persist as the chatbot’s memory, and conversations seamlessly adapt based on the program’s current state.


Key Features

  • Continuously Running Programs: AutoGRAMS lets you write chatbots as Python programs that maintain their state across interactions. Each user input resumes the program exactly where it left off, enabling highly dynamic, context-aware conversations.

  • Save and Resume Program State: Serialize the program’s entire state, including call stack, variables, and control flow. Reload it later to continue the program (and conversation) from its exact state.

  • Dynamic Control Flow: Use advanced constructs like GOTO to move between different parts of your program that represent different states of your chatbot. This allows complex, non-linear dialogue paths that adapt dynamically to user inputs and decisions.

  • LLM-Driven Decisions: Integrate decision-making powered by LLMs to dynamically guide conversations based on user input, enabling sophisticated branching of the program

  • Memory Management: AutoGRAMS automatically manages memory, ensuring that variables and conversation history persist across turns.

  • Visualize Conversation Flow: Compile detailed graphs of your chatbot’s states and logic, helping you design, debug, and understand the flow of conversation at a glance.

AutoGRAMS accomplishes many of these behaviors using a special @autograms_function decorator that enables non-standard python functionality such as saving and loading the state of a program mid-execution and jumping to a predefined location in the code.

The full documentation and tutorials are available in our web docs.

Installation

You can install AutoGRAMS via pip:

pip install autograms

If you make local modifications, you can install them with:

git clone https://github.com/autograms/autograms.git
cd autograms
pip install .

To visualize AutoGRAMS graphs, install Graphviz. On Linux:

sudo apt install graphviz

Python >=3.9 is required. If you plan to use OpenAI models or other LLM APIs, ensure you set up the necessary dependencies and keys.

Getting Started

AutoGRAMS makes it easy to build structured, stateful chatbots. To get started with a recruiter chatbot demo, you can set an open ai api key with:

export OPENAI_API_KEY=

and then you can run:

python run_autogram.py --api_key_file api_keys.json --example_name recruiter

This will launch an interactive chatbot in the terminal, simulating a virtual recruiter.

Visualization

AutoGRAMS includes tools to visualize the conversational flow as an interactive graph. For example, you can generate visualizations for the recruiter chatbot with:

python visualize_autogram.py --example_name recruiter --save_folder recruiter_graph

This will create both a static and interactive graph in the specified folder. You can explore the chatbot flow and decision points by clicking on nodes in the interactive graph.

Demos and Examples

Explore the /examples folder for more sample autograms. Each example demonstrates different capabilities of AutoGRAMS, from simple branching dialogues to complex, stateful agents.

To run a demo:

python run_autogram.py --api_key_file api_keys.json --example_name <example_name>

Replace <example_name> with the desired example (e.g., simple_example, fraction_tutor, general_tutor, or recruiter).

Citing AutoGRAMS

If you use this work in research, please cite the following paper:

@article{krause2024autograms,
  title={AutoGRAMS: Autonomous Graphical Agent Modeling Software},
  author={Krause, Ben and Chen, Lucia and Kahembwe, Emmanuel},
  journal={arXiv preprint arXiv:2407.10049},
  year={2024}
}

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

autograms-0.5.1.tar.gz (62.7 kB view details)

Uploaded Source

Built Distribution

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

autograms-0.5.1-py3-none-any.whl (66.7 kB view details)

Uploaded Python 3

File details

Details for the file autograms-0.5.1.tar.gz.

File metadata

  • Download URL: autograms-0.5.1.tar.gz
  • Upload date:
  • Size: 62.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.16

File hashes

Hashes for autograms-0.5.1.tar.gz
Algorithm Hash digest
SHA256 1acd9be0787e67caf32a09e5307c349f7e8c71bd737bb75de0aa956ebf18e9e7
MD5 dd615295c3b27f407458a93b70ca7b5f
BLAKE2b-256 b3a90acbe4e99695f9dccb6dd69161cbba0817195ac1c1e824704212defe7019

See more details on using hashes here.

File details

Details for the file autograms-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: autograms-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 66.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.16

File hashes

Hashes for autograms-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2018fa749194c705015b41cc4f7fb5fbf9dccbb253d13547eae42f2a6b98d9b0
MD5 c12a18fc81eaf51bf7febebe95691315
BLAKE2b-256 e9d8fa3efef5856f7236267575ef0c71b176a040ace21a103a3bde6222e75b6e

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