Skip to main content

A framework for creating AI applications and agents using natural language programming

Project description

Playbooks AI

Playbooks AI
LLM is your new CPU
Welcome to Software 3.0

GitHub License PyPI Version Python Version Documentation Test Lint GitHub issues PRs Welcome Contributors

Homepage

Build multi‑agent AI systems with ease using Python and natural language.

Stop writing prompts and hoping that the LLM will follow them faithfully. Instead, get verifiable natural language program execution with Playbooks.

Playbooks is an innovative framework for building and executing AI agents using "playbooks" – structured workflows defined in natural language and Python code. Created by Amol Kelkar, the framework is part of the world's first Software 3.0 tech stack, Playbooks AI. It includes a new programming language (markdown-formatted .pb files) that are compiled to Playbooks Assembly Language (.pbasm files), that are then executed by the Playbooks Runtime.

Unlike other AI agent frameworks, Playbooks programs are highly readable. Business users can understand, change, and approve agent behavior specified in natural language; while developers benefit from the flexibility of running Python code on CPU and natural lanuage code on LLM, on the same call stack, and with full observability and control.


Here is an example Playbooks program. It contains both Python and natural language "playbooks", i.e. functions. Notice how natural language playbook Main (line 4) calls (line 13) a Python playbook process_countries (line 20), which in turn calls (line 23) a natural language playbook GetCountryFact (line 27).

The following 29 line, highly readable Playbooks program is equivalent to more than 300 lines of complex LangGraph code.

country-facts.pb, an example Playbooks program -

# Country facts agent
This agent prints interesting facts about nearby countries

## Main
### Triggers
- At the beginning
### Steps
- Ask user what $country they are from
- If user did not provide a country, engage in a conversation and gently nudge them to provide a country
- List 5 $countries near $country
- Tell the user the nearby $countries
- Inform the user that you will now tell them some interesting facts about each of the countries
- process_countries($countries)
- End program

```python
from typing import List

@playbook
async def process_countries(countries: List[str]):
    for country in countries:
        # Calls the natural language playbook 'GetCountryFact' for each country
        fact = await GetCountryFact(country)
        await Say("user", f"{country}: {fact}")
```

## GetCountryFact($country)
### Steps
- Return an unusual historical fact about $country

Install Playbooks

# You will need Python 3.12+ and your Anthropic API key
pip install playbooks

Run using Playbooks CLI

ANTHROPIC_API_KEY=sk-ant-... playbooks run country-facts.pb

Run in Playbooks Playground

ANTHROPIC_API_KEY=sk-ant-... playbooks playground

Put your program path and click "Run Program". You can turn on "Execution Logs" to see the program execution details.

Run programmatically

from playbooks import Playbooks

pb = Playbooks(["country-facts.pb"]) # absolute or relative path
await pb.initialize()
await pb.program.run_till_exit()

Step debugging in VSCode (Optional)

Install the Playbooks Language Support extension for Visual Studio Code:

  1. Open VSCode
  2. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  3. Search for "Playbooks Language Support"
  4. Click Install

The extension provides debugging capabilities for playbooks programs, making it easier to develop and troubleshoot your AI agents. Once the plugin is installed, you can open a playbooks .pb file and start debugging!

📚 Documentation

Visit our documentation for comprehensive guides, tutorials, and reference materials.

Changelog

See CHANGELOG.md for the latest updates.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributors

We welcome contributions! Please see CONTRIBUTING.md for details.

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

playbooks-0.6.1.tar.gz (164.1 kB view details)

Uploaded Source

Built Distribution

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

playbooks-0.6.1-py3-none-any.whl (203.3 kB view details)

Uploaded Python 3

File details

Details for the file playbooks-0.6.1.tar.gz.

File metadata

  • Download URL: playbooks-0.6.1.tar.gz
  • Upload date:
  • Size: 164.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.5 Darwin/24.3.0

File hashes

Hashes for playbooks-0.6.1.tar.gz
Algorithm Hash digest
SHA256 ca8fb56ad68c5918c29ee00565002342b78089fc87c23c18d74d3ebd67075d3c
MD5 8bef3117dc9593d63a98490badcadbea
BLAKE2b-256 d4d2912df07b6fe369c9849cda5acab6037b4383cd2efbe154d32afceb249c14

See more details on using hashes here.

File details

Details for the file playbooks-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: playbooks-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 203.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.5 Darwin/24.3.0

File hashes

Hashes for playbooks-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e28b6eb9374264a8378ec2639393c6ccf298c6797ab742e0d54191b296684c34
MD5 e0014fbb896aefe893a38b95887d5d81
BLAKE2b-256 7ef8c3d466821e9a71e013b15c325de10d98a2de67007d027e89ed5c7b031c08

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