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.0.tar.gz (163.8 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.0-py3-none-any.whl (202.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: playbooks-0.6.0.tar.gz
  • Upload date:
  • Size: 163.8 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.0.tar.gz
Algorithm Hash digest
SHA256 390feecd7f0fd6c0a71e2f5403c3eb8fb20290fea0e3ca6e4c35b32facbf7b6a
MD5 76dcc1b461d5d188176e558b9fbe2408
BLAKE2b-256 c9f4e685c5cbde1c02ab97fc2c448bd324a328ace6bcb82765f4d4046e2bab21

See more details on using hashes here.

File details

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

File metadata

  • Download URL: playbooks-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 202.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4eb6c21e6b1fb0829575e922f4f0854313b5e1f41cdf72711393c0c6882418e
MD5 dae0830e03b911881451a470ac0bef0d
BLAKE2b-256 6df8ab45c434e11791458fe3e74ce21080d246e30376c5fa93b003af05fb409b

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