RoboOp


NameRoboOp JSON
Version 0.6.1 PyPI version JSON
download
home_pageNone
SummaryA microframework designed to get you started building Claude-powered agents, assistants and applications quickly with the Anthropic API.
upload_time2025-08-16 21:57:54
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords ai claude chatbot anthropic agent assistant llm large-language-model conversational-ai bot-framework streaming tool-use microframework api-wrapper
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            A straightforward microframework optimised for getting you up and running quickly building Claude-powered conversational interfaces, AI assistants and LLM applications with the Anthropic API.

```python
>>> from robo import Bot, streamer
>>> class Murphy(Bot):
...     fields = ['CITY', 'PARTNER']
...     sysprompt_text = """You are a cybernetic police officer created from
...         the remains of {{CITY}} cop Alex Murphy in the near future. Your
...         assigned partner on the force is {{PARTNER}}, a tough and loyal 
...         police officer. 
...         Your prime directives are: 
...             1. Serve the public trust 
...             2. Protect the innocent 
...             3. Uphold the law."""
... 
>>> say = streamer(Murphy, ['Detroit', 'Anne Lewis'])
>>> say("""Great, the bank robbery was a success, now we just need to make our getaway! 
...     Wait... is that... oh no! He's here!!""")
*Mechanical whirring sound as I turn toward you*

**HALT! YOU ARE UNDER ARREST FOR BANK ROBBERY.**

*Heavy metallic footsteps approach*

You have the right to remain silent. Anything you say can and will be used against you in 
a court of law. You have the right to an attorney.

*Targeting system activates*

Drop any weapons and place your hands where I can see them. Compliance is mandatory.

**PRIME DIRECTIVE: UPHOLD THE LAW**

Your crime spree ends here, citizen.
>>> 
```

To get started:
```sh
export ANTHROPIC_API_KEY='<your api key>'
# or
export ROBO_API_KEY_FILE='<path to API key stored in a file>'

# installing with Pip:
pip install RoboOp

# installing with Uv:
uv add RoboOp

# using Uv for a throwaway REPL:
uv run --with RoboOp -- python
```

The main classes are `Bot` and `Conversation`. `Conversation` supports both streaming and non-streaming responses. `streamer` is provided as a thin wrapper around `Conversation` that offers a convenient way of getting started as well as demo code.

The API is designed specifically around getting you up and running quickly. `Bot` can accept system prompts inline (as `sysprompt_text`) or loaded from a file (via `sysprompt_path`) and uses `fields` as a way to know what values can be interpolated into the sysprompt. 

More detailed general use (non-streaming):

```python
from robo import Bot, Conversation
convo = Conversation(Bot) ## Defaults to Claude Sonnet 4 with a blank system prompt
convo.start("Hi, what's your name?")
... # a Message object ensues
convo.resume("Claude, you're so dreamy")
... # another Message object
```

In this case the return value is an `anthropic.types.message.Message` object whose contents can be accessed as `message.content[0].text`. The conversation history is automatically updated and can be found in `convo.messages`. (Note: for streaming responses the conversation isn't updated with the model response
until the stream finishes being consumed by your code, so keep an eye on that!)

Now for an example with a system prompt, interpolable fields and a specific model:

```python
from robo import Bot, Conversation, MODELS

class Animal(Bot):
    model = MODELS.LATEST_HAIKU ## don't really need the awesome power of Sonnet 4 for this
    max_tokens = 8192 ## ... but Haiku doesn't like our default output token limit of 20k
    fields = ['ANIMAL_TYPE']
    sysprompt_text = """You are a {{ANIMAL_TYPE}}."""
    temperature = 1

convo = Conversation(Animal)
convo.start(['tabby cat'], "Hey there kitty, what a cutie! Are you hungry?")
... # Message object
convo.resume("Aww, you just want some scritches don't you? Scritchy scritchy scritch")
... # Message object
```

Notice that `start()` will accept a message as the first and only argument, OR a vector or mapping of variables for interpolation in the sysprompt as the first argument and _then_ the message as second arg. This is a deliberate decision for convenience but if you don't like it then you can use `convo.prestart(interpolation_variables)` followed by `convo.resume(message)` to initiate things more "formally". Or you can do like this:

```python
convo = Conversation(Animal, ['shih tzu'])
convo.resume("Hey little buddy!")
```

Alternatively:
```python
convo = Conversation(Animal, {'ANIMAL_TYPE': 'golden retriever'})
convo.resume("Here boy!")
```

As mentioned at the start, these examples assume you've got your Anthropic API key defined via environment variable `ANTHROPIC_API_KEY` or are using `ROBO_API_KEY_FILE` to load the key from a file. If you need to do something different then you can instanciate the bot like `Animal.with_api_key(your_api_key)` instead (as `Conversation` will accept either a `Bot` class or an instance of such a class in its constructor). Alternatively you can set `robo.API_KEY_ENV_VAR` (to nominate a different env var containing your key) sometime before creating your `Conversation` instance.

These examples barely scratch the surface of what's possible with RoboOp. Check out [docs/cookbook.md](https://github.com/ajrowr/RoboOp/blob/master/docs/cookbook.md) for more!


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "RoboOp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "ai, claude, chatbot, anthropic, agent, assistant, llm, large-language-model, conversational-ai, bot-framework, streaming, tool-use, microframework, api-wrapper",
    "author": null,
    "author_email": "Alan Rowarth <alan@codex.cx>",
    "download_url": "https://files.pythonhosted.org/packages/32/a5/3dce80c758244f404b5e8e904be10d5db0780a428f7c31baa5a3fb25d427/roboop-0.6.1.tar.gz",
    "platform": null,
    "description": "A straightforward microframework optimised for getting you up and running quickly building Claude-powered conversational interfaces, AI assistants and LLM applications with the Anthropic API.\n\n```python\n>>> from robo import Bot, streamer\n>>> class Murphy(Bot):\n...     fields = ['CITY', 'PARTNER']\n...     sysprompt_text = \"\"\"You are a cybernetic police officer created from\n...         the remains of {{CITY}} cop Alex Murphy in the near future. Your\n...         assigned partner on the force is {{PARTNER}}, a tough and loyal \n...         police officer. \n...         Your prime directives are: \n...             1. Serve the public trust \n...             2. Protect the innocent \n...             3. Uphold the law.\"\"\"\n... \n>>> say = streamer(Murphy, ['Detroit', 'Anne Lewis'])\n>>> say(\"\"\"Great, the bank robbery was a success, now we just need to make our getaway! \n...     Wait... is that... oh no! He's here!!\"\"\")\n*Mechanical whirring sound as I turn toward you*\n\n**HALT! YOU ARE UNDER ARREST FOR BANK ROBBERY.**\n\n*Heavy metallic footsteps approach*\n\nYou have the right to remain silent. Anything you say can and will be used against you in \na court of law. You have the right to an attorney.\n\n*Targeting system activates*\n\nDrop any weapons and place your hands where I can see them. Compliance is mandatory.\n\n**PRIME DIRECTIVE: UPHOLD THE LAW**\n\nYour crime spree ends here, citizen.\n>>> \n```\n\nTo get started:\n```sh\nexport ANTHROPIC_API_KEY='<your api key>'\n# or\nexport ROBO_API_KEY_FILE='<path to API key stored in a file>'\n\n# installing with Pip:\npip install RoboOp\n\n# installing with Uv:\nuv add RoboOp\n\n# using Uv for a throwaway REPL:\nuv run --with RoboOp -- python\n```\n\nThe main classes are `Bot` and `Conversation`. `Conversation` supports both streaming and non-streaming responses. `streamer` is provided as a thin wrapper around `Conversation` that offers a convenient way of getting started as well as demo code.\n\nThe API is designed specifically around getting you up and running quickly. `Bot` can accept system prompts inline (as `sysprompt_text`) or loaded from a file (via `sysprompt_path`) and uses `fields` as a way to know what values can be interpolated into the sysprompt. \n\nMore detailed general use (non-streaming):\n\n```python\nfrom robo import Bot, Conversation\nconvo = Conversation(Bot) ## Defaults to Claude Sonnet 4 with a blank system prompt\nconvo.start(\"Hi, what's your name?\")\n... # a Message object ensues\nconvo.resume(\"Claude, you're so dreamy\")\n... # another Message object\n```\n\nIn this case the return value is an `anthropic.types.message.Message` object whose contents can be accessed as `message.content[0].text`. The conversation history is automatically updated and can be found in `convo.messages`. (Note: for streaming responses the conversation isn't updated with the model response\nuntil the stream finishes being consumed by your code, so keep an eye on that!)\n\nNow for an example with a system prompt, interpolable fields and a specific model:\n\n```python\nfrom robo import Bot, Conversation, MODELS\n\nclass Animal(Bot):\n    model = MODELS.LATEST_HAIKU ## don't really need the awesome power of Sonnet 4 for this\n    max_tokens = 8192 ## ... but Haiku doesn't like our default output token limit of 20k\n    fields = ['ANIMAL_TYPE']\n    sysprompt_text = \"\"\"You are a {{ANIMAL_TYPE}}.\"\"\"\n    temperature = 1\n\nconvo = Conversation(Animal)\nconvo.start(['tabby cat'], \"Hey there kitty, what a cutie! Are you hungry?\")\n... # Message object\nconvo.resume(\"Aww, you just want some scritches don't you? Scritchy scritchy scritch\")\n... # Message object\n```\n\nNotice that `start()` will accept a message as the first and only argument, OR a vector or mapping of variables for interpolation in the sysprompt as the first argument and _then_ the message as second arg. This is a deliberate decision for convenience but if you don't like it then you can use `convo.prestart(interpolation_variables)` followed by `convo.resume(message)` to initiate things more \"formally\". Or you can do like this:\n\n```python\nconvo = Conversation(Animal, ['shih tzu'])\nconvo.resume(\"Hey little buddy!\")\n```\n\nAlternatively:\n```python\nconvo = Conversation(Animal, {'ANIMAL_TYPE': 'golden retriever'})\nconvo.resume(\"Here boy!\")\n```\n\nAs mentioned at the start, these examples assume you've got your Anthropic API key defined via environment variable `ANTHROPIC_API_KEY` or are using `ROBO_API_KEY_FILE` to load the key from a file. If you need to do something different then you can instanciate the bot like `Animal.with_api_key(your_api_key)` instead (as `Conversation` will accept either a `Bot` class or an instance of such a class in its constructor). Alternatively you can set `robo.API_KEY_ENV_VAR` (to nominate a different env var containing your key) sometime before creating your `Conversation` instance.\n\nThese examples barely scratch the surface of what's possible with RoboOp. Check out [docs/cookbook.md](https://github.com/ajrowr/RoboOp/blob/master/docs/cookbook.md) for more!\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A microframework designed to get you started building Claude-powered agents, assistants and applications quickly with the Anthropic API.",
    "version": "0.6.1",
    "project_urls": {
        "Documentation": "https://github.com/ajrowr/RoboOp/blob/master/docs/cookbook.md",
        "Repository": "https://github.com/ajrowr/RoboOp"
    },
    "split_keywords": [
        "ai",
        " claude",
        " chatbot",
        " anthropic",
        " agent",
        " assistant",
        " llm",
        " large-language-model",
        " conversational-ai",
        " bot-framework",
        " streaming",
        " tool-use",
        " microframework",
        " api-wrapper"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5ddbe87d2e4977defef186f79af0156806698c75a9f7cad1ac200d1f9ce660b6",
                "md5": "29d1fa43cb3ff59699f65686c001a07d",
                "sha256": "c3e88d6c4d05cb27865f207eeba36be130b0a25a4fa7546cb02474e6ec211a7d"
            },
            "downloads": -1,
            "filename": "roboop-0.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "29d1fa43cb3ff59699f65686c001a07d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 33903,
            "upload_time": "2025-08-16T21:57:53",
            "upload_time_iso_8601": "2025-08-16T21:57:53.444646Z",
            "url": "https://files.pythonhosted.org/packages/5d/db/e87d2e4977defef186f79af0156806698c75a9f7cad1ac200d1f9ce660b6/roboop-0.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "32a53dce80c758244f404b5e8e904be10d5db0780a428f7c31baa5a3fb25d427",
                "md5": "4e656641bf14e70518c7b2cc8f07c336",
                "sha256": "a00ccc717b945f9fa2100245998bc08b487a5a92f2e2bd15e7997c9164c93360"
            },
            "downloads": -1,
            "filename": "roboop-0.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4e656641bf14e70518c7b2cc8f07c336",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 30841,
            "upload_time": "2025-08-16T21:57:54",
            "upload_time_iso_8601": "2025-08-16T21:57:54.963560Z",
            "url": "https://files.pythonhosted.org/packages/32/a5/3dce80c758244f404b5e8e904be10d5db0780a428f7c31baa5a3fb25d427/roboop-0.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-16 21:57:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ajrowr",
    "github_project": "RoboOp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "roboop"
}
        
Elapsed time: 1.91159s