start prompt comes from back-end

This commit is contained in:
Steve Androulakis
2025-02-03 13:32:33 -08:00
parent 2a2383bb71
commit 36d4bd5889
7 changed files with 64 additions and 18 deletions

View File

@@ -132,3 +132,26 @@ async def end_chat():
print(e)
# Workflow not found; return an empty response
return {}
@app.post("/start-workflow")
async def start_workflow():
# Create combined input
combined_input = CombinedInput(
tool_params=ToolWorkflowParams(None, None),
agent_goal=goal_event_flight_invoice,
)
workflow_id = "agent-workflow"
# Start the workflow with the starter prompt from the goal
await temporal_client.start_workflow(
ToolWorkflow.run,
combined_input,
id=workflow_id,
task_queue=TEMPORAL_TASK_QUEUE,
start_signal="user_prompt",
start_signal_args=["### " + goal_event_flight_invoice.starter_prompt],
)
return {"message": f"Workflow started with goal's starter prompt: {goal_event_flight_invoice.starter_prompt}."}