-
4d870fe
Thanks @davidkpiano! - planner -> strategy agent.addPlan -> agent.addDecision agent.getPlans -> agent.getDecisionsThe word "strategy" is now used instead of "planner" to make it more clear what the agent is doing: it uses a strategy to make decisions. The method
agent.addPlan(…)
has been renamed toagent.addDecision(…)
andagent.getPlans(…)
has been renamed toagent.getDecisions(…)
to reflect this change. Additionally, you specify thestrategy
instead of theplanner
when creating an agent:const agent = createAgent({ - planner: createSimplePlanner(), + strategy: createSimpleStrategy(), ... });
-
f1189cb
Thanks @davidkpiano! - For feedback, thegoal
,observationId
, andattributes
are now required, andfeedback
andreward
are removed since they are redundant. -
7b16326
Thanks @davidkpiano! - You can specifyallowedEvents
inagent.decide(...)
to allow from a list of specific events to be sent to the agent. This is useful when usingagent.decide(...)
without a state machine.const agent = createAgent({ // ... events: { PLAY: z.object({}).describe("Play a move"), SKIP: z.object({}).describe("Skip a move"), FORFEIT: z.object({}).describe("Forfeit the game"), }, }); // ... const decision = await agent.decide({ // Don't allow the agent to send `FORFEIT` or other events allowedEvents: ["PLAY", "SKIP"], // ... });
6a9861d
Thanks @davidkpiano! - You can specifymaxAttempts
inagent.decide({ maxAttempts: 5 })
. This will allow the agent to attempt to make a decision up to the specified number ofmaxAttempts
before giving up. The default value is2
.
-
8c3eab8
Thanks @davidkpiano! - Thename
field increateAgent({ name: '...' })
has been renamed toid
. -
8c3eab8
Thanks @davidkpiano! - Thedescription
field increateAgent({ description: '...' })
is now used for thesystem
prompt in agent decision making when asystem
prompt is not provided.
- #51
574b6fd
Thanks @davidkpiano! - -agent.generateText(…)
is removed in favor of using the AI SDK'sgenerateText(…)
function with a wrapped model.agent.streamText(…)
is removed in favor of using the AI SDK'sstreamText(…)
function with a wrapped model.- Custom adapters are removed for now, but may be re-added in future releases. Using the AI SDK is recommended for now.
- Correlation IDs are removed in favor of using OpenTelemetry with the AI SDK.
- The
createAgentMiddleware(…)
function was introduced to facilitate agent message history. You can also useagent.wrap(model)
to wrap a model with Stately Agent middleware.
- #54
140fdce
Thanks @XavierDK! - - Addressing an issue where the fullStream property was not properly copied when using the spread operator (...). The problem occurred because fullStream is an iterator, and as such, it was not included in the shallow copy of the result object.- Update all packages
- #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(...)