Going through the docs, I found this contradictory...
# marvin-ai
n
Going through the docs, I found this contradictory: > Tasks define WHAT needs to be done. Agents determine HOW it will be done v/s > Tasks can be executed using the
run()
method When I use the
run()
method for a task (without defining any agents), is a default agent of some kind invoked? Can I modify its behaviour/system prompt/LLM model etc? I noticed this is done using GPT-4o.
If no agents are explicitly assigned to a task, ControlFlow will use the agents defined in a task’s parent task, flow, or fall back on a global default agent, respectively.
j
Hi @Nilesh Trivedi, that's exactly right and you've made me realize we haven't documented how to change the default agent! I'll get that fixed shortly. In the meantime, here's how you set a new default agent:
Copy code
import controlflow as cf

# create the agent with whatever config
# you want
agent = cf.Agent(<name, LLM, instructions, etc.>)

# assign the agent as the new global default here
cf.default_agent = agent

# confirm that a task created with no agents
# gets your new agent
assert agent in cf.Task('').get_agents()
n
Awesome! 👍