- #49
ae505d5
Thanks @davidkpiano! - Updateai
package
- #47
185c149
Thanks @davidkpiano! - Updateai
andxstate
packages
- #45
3c271f3
Thanks @davidkpiano! - Fix reading the actor logic
- #43
8e7629c
Thanks @davidkpiano! - Update dependencies
- #41
b2f2b73
Thanks @davidkpiano! - Update dependencies
-
#39
3cce30f
Thanks @davidkpiano! - Added four new methods for easily retrieving agent messages, observations, feedback, and plans:agent.getMessages()
agent.getObservations()
agent.getFeedback()
agent.getPlans()
The
agent.select(…)
method is deprecated in favor of these methods. -
#40
8b7c374
Thanks @davidkpiano! - Correlation IDs are now provided as part of the result fromagent.generateText(…)
andagent.streamText(…)
:const result = await agent.generateText({ prompt: "Write me a song", correlationId: "my-correlation-id", // ... }); result.correlationId; // 'my-correlation-id'
These correlation IDs can be passed to feedback:
// ... agent.addFeedback({ reward: -1, correlationId: result.correlationId, });
-
#40
8b7c374
Thanks @davidkpiano! - Changes to agent feedback (theAgentFeedback
interface):goal
is now optionalobservationId
is now optionalcorrelationId
has been added (optional)reward
has been added (optional)attributes
are now optional
-
#38
21fb17c
Thanks @davidkpiano! - You can now addcontext
Zod schema to your agent. For now, this is meant to be passed directly to the state machine, but in the future, the schema can be shared with the LLM agent to better understand the state machine and its context for decision making.Breaking: The
context
andevents
types are now inagent.types
instead of ~~agent.eventTypes
.const agent = createAgent({ // ... context: { score: z.number().describe("The score of the game"), // ... }, }); const machine = setup({ types: agent.types, }).createMachine({ context: { score: 0, }, // ... });
-
5f863bb
Thanks @davidkpiano! - Use nanoid -
#37
dafa815
Thanks @davidkpiano! - Messages are now properly included inagent.decide(…)
, when specified.
-
#32
537f501
Thanks @davidkpiano! - First minor release of@statelyai/agent
! The API has been simplified from experimental earlier versions. Here are the main methods:createAgent({ … })
creates an agentagent.decide({ … })
decides on a plan to achieve the goalagent.generateText({ … })
generates text based on a promptagent.streamText({ … })
streams text based on a promptagent.addObservation(observation)
adds an observation and returns a full observation objectagent.addFeedback(feedback)
adds a feedback and returns a full feedback objectagent.addMessage(message)
adds a message and returns a full message objectagent.addPlan(plan)
adds a plan and returns a full plan objectagent.onMessage(cb)
listens to messagesagent.select(selector)
selects data from the agent contextagent.interact(actorRef, getInput)
interacts with an actor and makes decisions to accomplish a goal
-
#22
8a2c34b
Thanks @davidkpiano! - ThecreateSchemas(…)
function has been removed. ThedefineEvents(…)
function should be used instead, as it is a simpler way of defining events and event schemas using Zod:import { defineEvents } from "@statelyai/agent"; import { z } from "zod"; import { setup } from "xstate"; const events = defineEvents({ inc: z.object({ by: z.number().describe("Increment amount"), }), }); const machine = setup({ types: { events: events.types, }, schema: { events: events.schemas, }, }).createMachine({ // ... });
- #18
dcaabab
Thanks @davidkpiano! -context
is now optional forcreateSchemas(…)
- #16
3ba5fb2
Thanks @davidkpiano! - Update to XState 5.8.0
-
#9
d8e7b67
Thanks @davidkpiano! - Addadapter.fromTool(…)
, which creates an actor that chooses agent logic based on a input.const actor = adapter.fromTool(() => "Draw me a picture of a donut", { // tools makeIllustration: { description: "Makes an illustration", run: async (input) => { /* ... */ }, inputSchema: { /* ... */ }, }, getWeather: { description: "Gets the weather", run: async (input) => { /* ... */ }, inputSchema: { /* ... */ }, }, }); //...
-
#5
ae473d7
Thanks @davidkpiano! - Simplify API (WIP) -
#5
687bed8
Thanks @davidkpiano! - AddcreateSchemas
,createOpenAIAdapter
, and changecreateAgent
- #1
3dc2880
Thanks @mellson! - Adds a convenient way to run the examples withpnpm example ${exampleName}
. If no example name is provided, the script will print the available examples. Also, adds a fun little loading animation to the joke example.
- e125728: Added
createAgent(...)