Beam is launching a new type of agent framework that is stateful and has concurrency built-in.
in_shopping_cart
or in_queue
.place_order
or accept_payment
. Each transition has:
order_12345_red_shoes
.hello world
chatbot. This chatbot will respond to messages from a user. It will ask the user for their name, and attempt to update the status of their order.
bot
, a transition
, and initial state markers
:
locations
and markers
, which represent state.
UserName
location and returns an OrderStatus
location.
context
, which is a class that provides various convenience methods for your bot.
confirm
flag to the transition:
OrderStatus
marker is created.
expose=false
to locations and transitions.context
.
Context variables can be used for prompting the user for input, creating blocking requests to the bot, and sending message to the user.
Available Commands
Method | Description |
---|---|
context.confirm() | Pause a transition until a user says yes or no. |
context.prompt() | Send a blocking or non-blocking request to the model (e.g., “summarize these reviews”). You can pass an optional wait_for_response=False boolean to make this non-blocking. |
context.remember() | Add an arbitrary JSON-serializable object to the conversation memory. |
context.say() | Output text to the user’s chat window. |
context.send_file() | Send a file to the user created during a transition. |
context.get_file() | Retrieve a file from the user during a transition. |
transition
, and create an interactive dialogue in your shell.
authorized=False
to your bot
: