See comment in the bottom of this description for a more detailed explanation. tl;dr is to refactor build_agent and make engine creation, function registration and agent creation independent from one another.
Also relevant here is to refactor agent_functions, which depend on the agent itself. One idea that comes to mind is to expand the PromptHandler and have it manage the state of the prompt, so that the agent always reads from that before each run (instead of directly changing the agent's prompt inside a function).
> however not sure how to handle the fact that this assignment ...
Not sure I understand. That could just stay where it is?
But my point is that sequence of operations should be:
Build the engine
Build the system prompt, either by formatting TRADING_AGENT_SYSTEM_PROMPT or by fetching a prompt from the db (not by looking for a particular string in the prompt)
Build the agent.
With maybe_append_function_definitions_into_prompt the hackyness is just moved somewhere else.
See comment in the bottom of this description for a more detailed explanation. tl;dr is to refactor
build_agent
and make engine creation, function registration and agent creation independent from one another.Also relevant here is to refactor
agent_functions
, which depend on the agent itself. One idea that comes to mind is to expand the PromptHandler and have it manage the state of the prompt, so that the agent always reads from that before each run (instead of directly changing the agent's prompt inside a function).Not sure I understand. That could just stay where it is?
So before:
After:
But my point is that sequence of operations should be:
TRADING_AGENT_SYSTEM_PROMPT
or by fetching a prompt from the db (not by looking for a particular string in the prompt)With
maybe_append_function_definitions_into_prompt
the hackyness is just moved somewhere else._Originally posted by @evangriffiths in https://github.com/gnosis/prediction-market-agent/pull/238#discussion_r1639831484_