Skip to main content

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

Project description

Playbooks AI

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

Playbooks is a framework and runtime for building verifiable multi-agent AI systems with Natural Language Programs.

Describe what your agents should do, not how to do it. Focus on agent behavior at a high level while the LLM handles implementation details and edge cases. Mix natural language and Python seamlessly on the same call stack. Get verifiable execution, full observability, and programs that business users can actually read and approve.

Here's a complete 29-line Playbooks program that orchestrates natural language and Python code together. Notice how the Main playbook (line 4) calls Python function process_countries (line 20), which then calls natural language playbook GetCountryFact (line 27).

# 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

This accomplishes the same task as implementations that are significantly longer and more complex using traditional agent frameworks.

Playbooks

What is Software 3.0?

Software 3.0 is the evolution from hand-coded algorithms (Software 1.0) and learned neural network weights (Software 2.0) to natural language as the primary programming interface.

In Playbooks, you write programs in human language that execute directly on large language models. The LLM acts as a semantic CPU that interprets and runs your instructions. Instead of translating business logic into formal code syntax or training models on data, you describe what you want in natural language, mix it seamlessly with Python when needed, and get verifiable, observable execution.

This changes how you build AI systems: business stakeholders can read and approve the actual program logic, AI systems become transparent rather than black boxes, and sophisticated agent behaviors become accessible without sacrificing control or understanding.

Why Playbooks?

  • Think at a Higher Level : Focus on what your agent should do, not implementation mechanics. Define complex, nuanced behaviors without getting lost in orchestration details. The framework handles the low-level execution.

  • Natural Exception Handling : The LLM handles edge cases and exceptional conditions smoothly without explicit code for every contingency. Your agents adapt to unexpected situations naturally.

  • Powerful Abstractions : Multi-agent meetings for complex coordination. Triggers for event-driven behavior. Seamless mixing of natural language and Python. Abstractions that would take hundreds of lines in other frameworks are built-in.

  • Readable by Everyone : Business stakeholders can read and approve the actual program logic. No more "black box" AI systems. What you write is what executes.

  • Verifiable & Observable : Unlike prompt engineering where you hope the LLM follows instructions, Playbooks guarantees verifiable execution. Step debugging in VSCode, detailed execution logs, full observability.

Get Started in 10 Minutes

Build your first AI agent with Playbooks. You'll need Python 3.12+ and an Anthropic API key.

Install Playbooks

pip install playbooks

Run the Country Facts Example

Try the more advanced example from above:

playbooks run country-facts.pb

You can also use the Playground for interactive development:

playbooks playground

The Playground provides a visual interface to run programs, view execution logs, and iterate quickly.

Step Debugging in VSCode

For production development, install the Playbooks Language Support extension:

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

Now you can set breakpoints and step through your agent's execution, just like traditional code!

📚 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.7.1.tar.gz (241.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.7.1-py3-none-any.whl (297.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: playbooks-0.7.1.tar.gz
  • Upload date:
  • Size: 241.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for playbooks-0.7.1.tar.gz
Algorithm Hash digest
SHA256 908a7ca8aa24c1a644111bfebf75598ac7b17e189310ee031b8f62c6199e4d57
MD5 62aabb2f8900af13fd2c9b10c677b5ae
BLAKE2b-256 af5cde3f174d984b974ac17078d390ac20dda9334bfe0af85ce73b46a05a00d8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: playbooks-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 297.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for playbooks-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c08a57219d9837ada7b1d69370afdda9e86f8cd2b4f0ef363a53c369a1a2731d
MD5 4f3bbef277f28669f0423e9bea6d815e
BLAKE2b-256 8d994c293aa90c770350a0101c052207f978df019c36e045f0c7c1d69675f177

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