Skip to content

Creating Agents Dynamically #641

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

Closed
bakikucukcakiroglu opened this issue May 2, 2025 · 4 comments
Closed

Creating Agents Dynamically #641

bakikucukcakiroglu opened this issue May 2, 2025 · 4 comments
Labels
question Question about using the SDK stale

Comments

@bakikucukcakiroglu
Copy link

Hello everyone,

My current app serves as a support/sales agent for online stores. Merchants are using my dashboard to set a system prompt depending on their needs and expected behaviors. However, trying to tell all the needs in a system prompt usually ends up with high hallucination rates. That is why I want my system to be a more modular and configurable.

I'm planning to have a dashboard medium where the merchants can create their agents, add pre-defined tools to those agents, select handoffs etc. Actually a UI for agents architecture. However, I couldn't find a way to make dynamically created agents work.

Let's say every customers created their own unique architecture based on their unique needs on the dashboard and I stored all the information in convenient data structures. Is it possible to fetch and dynamically create the agents objects in the backend to respond to each merchant's customer with the agent architecture created by the customer.

Any help is appreciated.

@bakikucukcakiroglu bakikucukcakiroglu added the question Question about using the SDK label May 2, 2025
@jneeee
Copy link

jneeee commented May 4, 2025

A simpledirty way is using pickle to dump the objects to db. Then you could load and edit it when need.

@pakrym-oai
Copy link
Contributor

Agent/tool definitions have nothing inherently static about them. Most samples initialize them once but they are initialized using code.

You can load your agent definition from DB, then create and run a dynamic instance

agent_model = load_db_mode()
spanish_agent = Agent(
    name=agent_model.name,
    instructions=agent_model.instructions,
   ...
)

Tools are essentially the same. @function_tool helper is used to extract tool definitions from python functions but you can replicate the code and generate definitions from your data structures.

Copy link

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label May 13, 2025
Copy link

This issue was closed because it has been inactive for 3 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about using the SDK stale
Projects
None yet
Development

No branches or pull requests

3 participants