Skip to content

Latest commit

 

History

History
215 lines (149 loc) · 8.43 KB

CHANGELOG.md

File metadata and controls

215 lines (149 loc) · 8.43 KB

@statelyai/agent

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(...)