Skip to main content

No project description provided

Project description

Agentscript.rs

A Rust based interpreter for the Agentscript language.

Syntax

Invoke

Invoke a tool based on the ToolsV1 protocol.

An example of invoking the Translator tool to translate text from English to Spanish

We need to do translation <invoke tool="Translator" action="translate" parameters={"text": "Hello", "options": {"from": "en", "to": "es"}} />

Python API

pip install agentscript

Usage

Execute the tranlator tool from python

from agentscript import Interpreter
from agent_tools import Tool, action

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

    @action
    def translate(self, text: str, options: Dict[str, Any]) -> str:
        return "Hola"


# Create the interpreter supplying our translator tool
interpreter = Interpreter(tools=[Translator()])

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

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

Devloping

When changing the rust code

make develop-rs

Will complile it and make the package available to the Python project.

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.0.tar.gz (30.9 kB view hashes)

Uploaded Source

Built Distributions

agentscript-0.1.0-py3-none-any.whl (2.3 kB view hashes)

Uploaded Python 3

agentscript-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (715.4 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

Supported by

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