Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agent State Logging for Enhanced Understanding of State Composition #197

Closed
ArsalonAmini2024 opened this issue Jan 7, 2025 · 5 comments
Closed
Assignees

Comments

@ArsalonAmini2024
Copy link
Collaborator

As RSP, we want to Implement logging for agent state composition so that we can understand state composition across various agent actions.

Acceptance Criteria:

  • log agent initial state
  • log as agent updates state
  • log specific memories used in composing agent state (Message History, Factual Memory, Knowledge Base, Relationship Tracking, RAG Integration)

interface State {
    userId?: UUID;
    agentId?: UUID;
    roomId: UUID;
    bio: string;
    lore: string;
    agentName?: string;
    senderName?: string;
    actors: string;
    actorsData?: Actor[];
    recentMessages: string;
    recentMessagesData: Memory[];
    goals?: string;
    goalsData?: Goal[];
    actions?: string;
    actionNames?: string;
    providers?: string;
}


interface IAgentRuntime {
    // Core identification
    agentId: UUID;
    serverUrl: string;
    token: string;

    // Configuration
    character: Character;
    modelProvider: ModelProviderName;

    // Components
    actions: Action[];
    evaluators: Evaluator[];
    providers: Provider[];

    // Database & Memory
    databaseAdapter: IDatabaseAdapter;
    messageManager: IMemoryManager;
    descriptionManager: IMemoryManager;
    loreManager: IMemoryManager;
}


// Evaluate message
const evaluationResults = await runtime.evaluate(message, state, didRespond);


const memoryManager = runtime.getMemoryManager("messages");
await memoryManager.createMemory({
    id: messageId,
    content: { text: "Message content" },
    userId,
    roomId,
});


// Compose initial state
const state = await runtime.composeState(message, {
    additionalContext: "custom-context",
});

// Update message state
const updatedState = await runtime.updateRecentMessageState(state);

messageManager - conversation messages and responses
descriptionManager - user descriptions and profiles
loreManager - static character knowledge

const stateAction: Action = {
    name: "UPDATE_STATE",
    handler: async (runtime, message, state) => {
        const newState = await runtime.composeState(message, {
            additionalData: "new-data",
        });

        await runtime.updateState(newState);
        return true;
    },
};

Copy link

github-actions bot commented Jan 7, 2025

Hello @ArsalonAmini2024! Welcome to the ai16z community. Thank you for opening your first issue; we appreciate your contribution. You are now a ai16z contributor!

@jzvikart
Copy link
Collaborator

jzvikart commented Jan 8, 2025

@jkbrooks @ArsalonAmini2024 Do we want to do this in our fork or do we plan to merge it upstream?

@ArsalonAmini2024
Copy link
Collaborator Author

ArsalonAmini2024 commented Jan 8, 2025

For what we want to do here, we may consider the idea of integrating Eliza framework with a SaaS tool such as https://www.promptlayer.com/platform/observability

Just an idea ^^

Also we want an AI agent to be able to observe these in future so maybe we need a solution that can be accessed via an AI agent

@ArsalonAmini2024
Copy link
Collaborator Author

NOTE - this maybe already covered by

In which can we can close this out or link it to the PR above ^^

CC: @monilpat @jzvikart

@TimKozak
Copy link
Collaborator

Conversation moved to #196 . This ticket is redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants