-
Notifications
You must be signed in to change notification settings - Fork 78
Fix/277 runner lifecycling #283
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
Conversation
Signed-off-by: Casper Nielsen <casper@diagrid.io>
… and .start()'ing during init Signed-off-by: Casper Nielsen <casper@diagrid.io>
…stop() Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
… in a runner Signed-off-by: Casper Nielsen <casper@diagrid.io>
…lready running Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
|
@CasperGN this simplifies runner usage significantly. IMO shutdown could be simplified tiny bit more. |
|
@bibryam actually now that I think more about this, the What about something like this: # then AgentRunner
class AgentRunner()...
def __init__():
self.managed_agents = []
..
def run(): # and the other func's that calls agent.start()
agent.start()
self.managed_agents.append(agent)
def shutdown(agent: Optional[Any]), ..):
if agent:
if agent in self.managed_agents:
agent.stop()
self.managed_agents.remove(agent)
return
# continue with full shutdownThoughts? |
…g of append, remove and stop() Signed-off-by: Casper Nielsen <casper@diagrid.io>
Cyb3rWard0g
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you @CasperGN !
Description
This also carries a fix to the quickstarter tests.
Moving lifecycling of
DurableAgentintoAgentRunnerfor a more streamlined instantiation.The
AgentRunnerwill now handle runningagent.start()inrunservesubscriberegister_routesIt will catch the
RuntimeErrorthrown by the agent if already running andpass.AgentRunner().shutdown()now overrides and takes theagent: Anyparameter to callagent.stop()moving the lifecycle of the agent into the runner:Before:
Now:
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: Closes #277
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list:
No tests needed updates as the agents are never passed to an
AgentRunner.tests/integration/quickstarts/test_03_durable_agent_tool_call.pyhas a dependency onarize-phoenix-otel- @Cyb3rWard0g is this intentional or a leftover? See here