Skip to main content

A programming language for AI agents

Project description


Agentscript

A programming language for AI agents
Explore the docs »

View Demo · Report Bug · Request Feature


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

pip install agentscript

Usage

Execute the translator tool from 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

import Agentscript from "@agentsea/agentscript";

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

Components

Boolean

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

Image

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

Invoke

(
  <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

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

make test

To publish

make publish

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

agentscript-0.1.3.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

agentscript-0.1.3-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file agentscript-0.1.3.tar.gz.

File metadata

  • Download URL: agentscript-0.1.3.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.1 Darwin/22.6.0

File hashes

Hashes for agentscript-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c5c6cc6e67629b0819338acc9dd70e02839a0ddb5ed021b79493e0c803307ae3
MD5 e674f79edf7575755571c8db71c9e7b0
BLAKE2b-256 abc77c2a6de7a9609df90f11a2bd73549c6a528a5fa96c18cf480cd6d9f88ec4

See more details on using hashes here.

File details

Details for the file agentscript-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: agentscript-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.1 Darwin/22.6.0

File hashes

Hashes for agentscript-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 478ce080be41b3055571ac5273d24d018c5be8011c4b4416897b7524cc203def
MD5 ab3368761ebaf94c67c5f74b99bd1d06
BLAKE2b-256 eb8f61e9752db8c62f275c9f1feac30d64a80eea615878eed661e4ca0c4fbfc2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page