agentscript


Nameagentscript JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryA programming language for AI agents
upload_time2024-03-29 21:40:07
maintainerNone
docs_urlNone
authorPatrick Barker
requires_python<4.0,>=3.10
licenseApache 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- PROJECT LOGO -->
<br />
<p align="center">
  <!-- <a href="https://github.com/agentsea/skillpacks">
    <img src="https://project-logo.png" alt="Logo" width="80">
  </a> -->

  <h1 align="center">Agentscript</h1>

  <p align="center">
    A programming language for AI agents
    <br />
    <a href="https://github.com/agentsea/agentscript"><strong>Explore the docs »</strong></a>
    <br />
    <br />
    <a href="https://github.com/agentsea/agentscript">View Demo</a>
    ·
    <a href="https://github.com/agentsea/agentscript/issues">Report Bug</a>
    ·
    <a href="https://github.com/agentsea/agentscript/issues">Request Feature</a>
  </p>
  <br>
</p>

Agentscript is an isomorphic programming language for AI agents, it includes both a server-side interpreter and browser-based renderer.

▶ On the server, agenscript directly interprets LMM outputs and executes actions in a streaming manner.

▶ In the browser, agentscript renders LLM outputs in a rich manner and provides live updates.

## Server-side Interpreter

The server-side interpreter is capable of executing actions in a streaming manner, and supplying updates on their results to the UI.

### Install

```bash
pip install agentscript
```

## Usage

Execute the translator tool from Python

```python
from agentscript import Interpreter, Use
from toolfuse import Tool, action

# Create a fake translator tool
class Translator(Tool):
    """A fake translator tool"""

    @action
    def translate(self, text: str) -> str:
        return "Hola"


# Add the tool to the Use command
cmd = Use(tools=[Translator()])

# Create the interpreter supplying our Use command
interpreter = Interpreter(commands=[cmd])

# Parse the script, find the tool, and execute it
interpreter.execute("""
We need to do translation <{"type": "use", "tool": "Translator", "action": "translate", "parameters": {"text": "Hello", "options": {"from": "en", "to": "es"}}}>
""")

# Show the past invocations with the results
print(interpreter.invocations())
```

## Browser-based Renderer

### Install

```
npm i @agentsea/agentscript
```

### Usage

```javascript
import Agentscript from "@agentsea/agentscript";

(
  <Agentscript text="I created this image for you <Image url='https://any.url' />" url="...">
)
```

### Components

#### Boolean

```js
(
  <Agentscript text="Does this work for you? <Boolean />" >
)
```

#### Image

```js
(
  <Agentscript text="I created this image for you <Image src='https://any.url' />"">
)
```

#### Invoke

```js
(
  <Agentscript text='Lets check the weather <Invoke tool="Weather" action="get" parameters={"location": "Madrid"} />'>
)
```

## Dialects

The above components are known as the `common` dialect, but you can create your own dialects as well

## Roadmap

### Programable LLMs

Give agentscript the ability to program an LLM. Here we load a LoRA into a PEFT compatible LLM

```python
interpreter.execute("I need to load the weather LoRA <Load lora='weather' />")
```

### Browser components

- [ ] Select One
- [ ] Select Any
- [ ] Video
- [ ] Plan
- [ ] References
- [ ] Image with bounding box
- [ ] Task
- [ ] Markdown
- [ ] Code blocks

## Develop

To test

```sh
make test
```

To publish

```sh
make publish
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "agentscript",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Patrick Barker",
    "author_email": "patrickbarkerco@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ab/c7/7c2a6de7a9609df90f11a2bd73549c6a528a5fa96c18cf480cd6d9f88ec4/agentscript-0.1.3.tar.gz",
    "platform": null,
    "description": "<!-- PROJECT LOGO -->\n<br />\n<p align=\"center\">\n  <!-- <a href=\"https://github.com/agentsea/skillpacks\">\n    <img src=\"https://project-logo.png\" alt=\"Logo\" width=\"80\">\n  </a> -->\n\n  <h1 align=\"center\">Agentscript</h1>\n\n  <p align=\"center\">\n    A programming language for AI agents\n    <br />\n    <a href=\"https://github.com/agentsea/agentscript\"><strong>Explore the docs \u00bb</strong></a>\n    <br />\n    <br />\n    <a href=\"https://github.com/agentsea/agentscript\">View Demo</a>\n    \u00b7\n    <a href=\"https://github.com/agentsea/agentscript/issues\">Report Bug</a>\n    \u00b7\n    <a href=\"https://github.com/agentsea/agentscript/issues\">Request Feature</a>\n  </p>\n  <br>\n</p>\n\nAgentscript is an isomorphic programming language for AI agents, it includes both a server-side interpreter and browser-based renderer.\n\n\u25b6 On the server, agenscript directly interprets LMM outputs and executes actions in a streaming manner.\n\n\u25b6 In the browser, agentscript renders LLM outputs in a rich manner and provides live updates.\n\n## Server-side Interpreter\n\nThe server-side interpreter is capable of executing actions in a streaming manner, and supplying updates on their results to the UI.\n\n### Install\n\n```bash\npip install agentscript\n```\n\n## Usage\n\nExecute the translator tool from Python\n\n```python\nfrom agentscript import Interpreter, Use\nfrom toolfuse import Tool, action\n\n# Create a fake translator tool\nclass Translator(Tool):\n    \"\"\"A fake translator tool\"\"\"\n\n    @action\n    def translate(self, text: str) -> str:\n        return \"Hola\"\n\n\n# Add the tool to the Use command\ncmd = Use(tools=[Translator()])\n\n# Create the interpreter supplying our Use command\ninterpreter = Interpreter(commands=[cmd])\n\n# Parse the script, find the tool, and execute it\ninterpreter.execute(\"\"\"\nWe need to do translation <{\"type\": \"use\", \"tool\": \"Translator\", \"action\": \"translate\", \"parameters\": {\"text\": \"Hello\", \"options\": {\"from\": \"en\", \"to\": \"es\"}}}>\n\"\"\")\n\n# Show the past invocations with the results\nprint(interpreter.invocations())\n```\n\n## Browser-based Renderer\n\n### Install\n\n```\nnpm i @agentsea/agentscript\n```\n\n### Usage\n\n```javascript\nimport Agentscript from \"@agentsea/agentscript\";\n\n(\n  <Agentscript text=\"I created this image for you <Image url='https://any.url' />\" url=\"...\">\n)\n```\n\n### Components\n\n#### Boolean\n\n```js\n(\n  <Agentscript text=\"Does this work for you? <Boolean />\" >\n)\n```\n\n#### Image\n\n```js\n(\n  <Agentscript text=\"I created this image for you <Image src='https://any.url' />\"\">\n)\n```\n\n#### Invoke\n\n```js\n(\n  <Agentscript text='Lets check the weather <Invoke tool=\"Weather\" action=\"get\" parameters={\"location\": \"Madrid\"} />'>\n)\n```\n\n## Dialects\n\nThe above components are known as the `common` dialect, but you can create your own dialects as well\n\n## Roadmap\n\n### Programable LLMs\n\nGive agentscript the ability to program an LLM. Here we load a LoRA into a PEFT compatible LLM\n\n```python\ninterpreter.execute(\"I need to load the weather LoRA <Load lora='weather' />\")\n```\n\n### Browser components\n\n- [ ] Select One\n- [ ] Select Any\n- [ ] Video\n- [ ] Plan\n- [ ] References\n- [ ] Image with bounding box\n- [ ] Task\n- [ ] Markdown\n- [ ] Code blocks\n\n## Develop\n\nTo test\n\n```sh\nmake test\n```\n\nTo publish\n\n```sh\nmake publish\n```\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "A programming language for AI agents",
    "version": "0.1.3",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb8f61e9752db8c62f275c9f1feac30d64a80eea615878eed661e4ca0c4fbfc2",
                "md5": "ab3368761ebaf94c67c5f74b99bd1d06",
                "sha256": "478ce080be41b3055571ac5273d24d018c5be8011c4b4416897b7524cc203def"
            },
            "downloads": -1,
            "filename": "agentscript-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ab3368761ebaf94c67c5f74b99bd1d06",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 14121,
            "upload_time": "2024-03-29T21:40:05",
            "upload_time_iso_8601": "2024-03-29T21:40:05.992607Z",
            "url": "https://files.pythonhosted.org/packages/eb/8f/61e9752db8c62f275c9f1feac30d64a80eea615878eed661e4ca0c4fbfc2/agentscript-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "abc77c2a6de7a9609df90f11a2bd73549c6a528a5fa96c18cf480cd6d9f88ec4",
                "md5": "e674f79edf7575755571c8db71c9e7b0",
                "sha256": "c5c6cc6e67629b0819338acc9dd70e02839a0ddb5ed021b79493e0c803307ae3"
            },
            "downloads": -1,
            "filename": "agentscript-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "e674f79edf7575755571c8db71c9e7b0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 10303,
            "upload_time": "2024-03-29T21:40:07",
            "upload_time_iso_8601": "2024-03-29T21:40:07.690878Z",
            "url": "https://files.pythonhosted.org/packages/ab/c7/7c2a6de7a9609df90f11a2bd73549c6a528a5fa96c18cf480cd6d9f88ec4/agentscript-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-29 21:40:07",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "agentscript"
}
        
Elapsed time: 0.20953s