feat: send agent prompt -> prompt agent
This commit is contained in:
1 parent
161dfd507f
commit
0dee6a392f
7 files changed
+199
-105
No files matched your search
@@ -180,10 +180,15 @@ class AgentMixin:
|
||||
runs = [r for r in runs if r.user_id == user_id]
|
||||
return [r.serialize() for r in runs]
|
||||
|
||||
async def send_agent_prompt(self, agent_id, instruction, input=None, options={}):
|
||||
async def prompt_agent(self, agent_id, instruction, input=None, options={}):
|
||||
# Mirror agent.prompt's generator so run ownership and lifecycle stay
|
||||
# inside the mixin: callers just iterate and receive the same raw
|
||||
# inference.Message objects. get_agent_control is awaited lazily on first
|
||||
# iteration, keeping the control object alive for the generator's
|
||||
# lifetime.
|
||||
control = await self.get_agent_control(agent_id)
|
||||
response = await control.prompt(instruction, input, **options)
|
||||
return response
|
||||
async for msg in control.prompt(instruction, input, **options):
|
||||
yield msg
|
||||
|
||||
async def call_agent_action(self, agent_id, action, args):
|
||||
control = await self.get_agent_control(agent_id)
|
||||
|
||||
Reference in new issue
Block a user