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

Dynamic agent creation (i.e. persisting system_prompt, result_type, etc in DB) #973

Open
seunggs opened this issue Feb 23, 2025 · 4 comments
Assignees

Comments

@seunggs
Copy link

seunggs commented Feb 23, 2025

I have a use case where the users are able to create a custom agent with desired system_prompt, result_type, etc which get stored in a relational database (Postgres in my case). During the chat with the agent, the frontend just sends the agent_id and the backend grabs the rest of the information from the DB to instantiate a Pydantic AI Agent.

But I learned that Pydantic models cannot be easily serialized to JSON to be persisted in DB. What is the recommended strategy here to enable my dynamic agent creation use case?

Any guidance is appreciated!

@seunggs seunggs changed the title Dynamic agent creation (i.e. storing system_prompt, result_type, etc in DB) Dynamic agent creation (i.e. persisting system_prompt, result_type, etc in DB) Feb 23, 2025
@Kludex
Copy link
Member

Kludex commented Feb 24, 2025

@Finndersen
Copy link

@Kludex I think the agent config params that @seunggs is referring to are mostly stored in the GraphAgentDeps as configuration parameters, and I'm not sure whether storing that is in scope of that state persistence initiative (AFAIK the plan is to just store the Node state and the GraphAgentState).

So @seunggs you might need a custom implementation to store & retrieve those agent config params that you are interested in

@seunggs
Copy link
Author

seunggs commented Feb 25, 2025

@Finndersen OK got it thanks for confirming - you can close as not planned if you'd like

@Finndersen
Copy link

Might be worth also getting some input from the Pydantic team

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

No branches or pull requests

4 participants