Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: add a last_run field to the agent state model #1124

Merged
merged 4 commits into from
Mar 11, 2024
Merged

Conversation

cpacker
Copy link
Collaborator

@cpacker cpacker commented Mar 10, 2024

Please describe the purpose of this pull request.

  • add a last_run field to the agent state model
    • value updated lazily (on access)
    • should use the value from messages[-1].created_at
  • correct AgentStateModel's created_at to be a datetime (like the other created_at fields) instead of an int

Question for @sarahwooders - another way to do this is to keep a last_run field inside the AgentState.state that gets updated dynamically/eagerly when Agent.step() is called. Any preference on eager vs lazy?

How to test

Run an API call to list all agents (https://memgpt.readme.io/reference/list_agents_api_agents_get) and the last_run fields should exist and be valid.

Have you tested this PR?

GET localhost:8283/api/agents

{
	"num_agents": 6,
	"agents": [
		{
			"id": "1082d3e2-2e4d-40a7-9a2f-613934c3e19f",
			"name": "ResilientHarpsichord",
			"human": "basic",
			"persona": "sam_pov",
			"created_at": "2024-03-05T16:41:57.947029",
			"last_run": "2024-03-05T17:12:05.193843"
		},
...

@cpacker cpacker added the API Related to MemGPT API label Mar 10, 2024
@cpacker cpacker marked this pull request as ready for review March 11, 2024 00:18
@cpacker cpacker requested a review from sarahwooders March 11, 2024 01:02
@cpacker cpacker merged commit a547c10 into main Mar 11, 2024
5 checks passed
@cpacker cpacker deleted the add-last-run branch March 11, 2024 01:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
API Related to MemGPT API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant