Skip to content

Latest commit

 

History

History
334 lines (232 loc) · 15 KB

CHANGELOG.md

File metadata and controls

334 lines (232 loc) · 15 KB

@statelyai/agent

2.0.0-next.4

Major Changes

  • 4a79bac Thanks @davidkpiano! - - The machine and machineHash properties were removed from AgentObservation and AgentObservationInput
    • The defaultOptions property was removed from Agent
    • AgentDecideOptions was renamed to AgentDecideInput
    • The execute property was removed from AgentDecideInput
    • The episodeId optional property was added to AgentDecideInput, AgentObservationInput, and AgentFeedbackInput
    • decisionId was added to AgentObservationInput and AgentFeedbackInput

2.0.0-next.3

Major Changes

  • bf6b468 Thanks @davidkpiano! - The state can no longer be specified in agent.interact(...), since the actual state value is already observed and passed to the strategy function.

    The context provided to agent decision functions, like agent.decide({ context }) and in agent.interact(...), is now used solely to override the state.context provided to the prompt template.

Minor Changes

Patch Changes

  • 5b5a8e7 Thanks @davidkpiano! - The score is now required for feedback:

    agent.addFeedback({
      score: 0.5,
      goal: "Win the game",
      observationId: "...",
    });
  • 5b5a8e7 Thanks @davidkpiano! - The entire observed state must be provided, instead of only context, for any agent decision making functions:

    agent.interact(actor, (obs) => {
      // ...
      return {
        goal: "Some goal",
        // instead of context
        state: obs.state,
      };
    });
  • 9d65d71 Thanks @davidkpiano! - Remove goal from feedback input

2.0.0-next.2

Minor Changes

  • 4d870fe Thanks @davidkpiano! - planner -> strategy agent.addPlan -> agent.addDecision agent.getPlans -> agent.getDecisions

    The 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 to agent.addDecision(…) and agent.getPlans(…) has been renamed to agent.getDecisions(…) to reflect this change. Additionally, you specify the strategy instead of the planner when creating an agent:

    const agent = createAgent({
    - planner: createSimplePlanner(),
    + strategy: createSimpleStrategy(),
      ...
    });
  • f1189cb Thanks @davidkpiano! - For feedback, the goal, observationId, and attributes are now required, and feedback and reward are removed since they are redundant.

  • 7b16326 Thanks @davidkpiano! - You can specify allowedEvents in agent.decide(...) to allow from a list of specific events to be sent to the agent. This is useful when using agent.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"],
      // ...
    });

2.0.0-next.1

Minor Changes

  • 6a9861d Thanks @davidkpiano! - You can specify maxAttempts in agent.decide({ maxAttempts: 5 }). This will allow the agent to attempt to make a decision up to the specified number of maxAttempts before giving up. The default value is 2.

Patch Changes

  • 8c3eab8 Thanks @davidkpiano! - The name field in createAgent({ name: '...' }) has been renamed to id.

  • 8c3eab8 Thanks @davidkpiano! - The description field in createAgent({ description: '...' }) is now used for the system prompt in agent decision making when a system prompt is not provided.

2.0.0-next.0

Major Changes

  • #51 574b6fd Thanks @davidkpiano! - - agent.generateText(…) is removed in favor of using the AI SDK's generateText(…) function with a wrapped model.
    • agent.streamText(…) is removed in favor of using the AI SDK's streamText(…) 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 use agent.wrap(model) to wrap a model with Stately Agent middleware.

1.1.6

Patch Changes

  • #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

1.1.5

Patch Changes

1.1.4

Patch Changes

1.1.3

Patch Changes

1.1.2

Patch Changes

1.1.1

Patch Changes

1.1.0

Minor Changes

  • #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 from agent.generateText(…) and agent.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 (the AgentFeedback interface):

    • goal is now optional
    • observationId is now optional
    • correlationId has been added (optional)
    • reward has been added (optional)
    • attributes are now optional
  • #38 21fb17c Thanks @davidkpiano! - You can now add context 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 and events types are now in agent.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,
      },
      // ...
    });

Patch Changes

0.1.0

Minor Changes

  • #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 agent
    • agent.decide({ … }) decides on a plan to achieve the goal
    • agent.generateText({ … }) generates text based on a prompt
    • agent.streamText({ … }) streams text based on a prompt
    • agent.addObservation(observation) adds an observation and returns a full observation object
    • agent.addFeedback(feedback) adds a feedback and returns a full feedback object
    • agent.addMessage(message) adds a message and returns a full message object
    • agent.addPlan(plan) adds a plan and returns a full plan object
    • agent.onMessage(cb) listens to messages
    • agent.select(selector) selects data from the agent context
    • agent.interact(actorRef, getInput) interacts with an actor and makes decisions to accomplish a goal

0.0.8

Patch Changes

  • #22 8a2c34b Thanks @davidkpiano! - The createSchemas(…) function has been removed. The defineEvents(…) 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({
      // ...
    });

0.0.7

Patch Changes

0.0.6

Patch Changes

0.0.5

Patch Changes

  • #9 d8e7b67 Thanks @davidkpiano! - Add adapter.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: {
          /* ... */
        },
      },
    });
    
    //...

0.0.4

Patch Changes

0.0.3

Patch Changes

  • #1 3dc2880 Thanks @mellson! - Adds a convenient way to run the examples with pnpm 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.

0.0.2

Patch Changes

  • e125728: Added createAgent(...)