-
Notifications
You must be signed in to change notification settings - Fork 21
/
ExampleAgent.py
43 lines (35 loc) · 1.13 KB
/
ExampleAgent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from textwrap import dedent
from typing import Annotated, Callable
from autotx import AutoTx, AutoTxAgent, AutoTxTool
name = "example-agent"
system_message = dedent(f"""
Example of an agent system message.
...
"""
)
class ExampleTool(AutoTxTool):
name: str = "example_tool"
description: str = dedent(
"""
This tool does something very useful.
"""
)
def build_tool(self, autotx: AutoTx) -> Callable[[float, str], str]:
def run(
amount: Annotated[float, "Amount of something."],
receiver: Annotated[str, "The receiver of something."]
) -> str:
# TODO: do something useful
autotx.notify_user(f"ExampleTool run: {amount} {receiver}")
# NOTE: you can add intents to AutoTx's current bundle
# autotx.intents.append(tx)
return f"Something useful has been done with {amount} to {receiver}"
return run
class ExampleAgent(AutoTxAgent):
name=name
system_message=system_message
tools=[
ExampleTool(),
# AnotherTool(...),
# AndAnotherTool(...)
]