mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-15 14:08:08 +01:00
readme update
This commit is contained in:
@@ -34,7 +34,6 @@ async def main():
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Starting worker")
|
||||
print("Then run 'python send_message.py \"<prompt>\"'")
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import asyncio
|
||||
import sys
|
||||
from temporalio.client import Client
|
||||
|
||||
from models.data_types import CombinedInput, AgentGoal, ToolWorkflowParams
|
||||
from tools.tool_registry import event_travel_tools
|
||||
from workflows.tool_workflow import ToolWorkflow
|
||||
|
||||
|
||||
async def main(prompt: str):
|
||||
# Build the AgentGoal
|
||||
agent_goal = AgentGoal(
|
||||
tools=event_travel_tools,
|
||||
description="Helps the user find an event to travel to, search flights, and create an invoice for those flights.",
|
||||
)
|
||||
|
||||
# 2) Create combined input
|
||||
combined_input = CombinedInput(
|
||||
tool_params=ToolWorkflowParams(None, None),
|
||||
agent_goal=agent_goal,
|
||||
)
|
||||
|
||||
# 3) Connect to Temporal and start or signal the workflow
|
||||
client = await Client.connect("localhost:7233")
|
||||
workflow_id = "agent-workflow"
|
||||
|
||||
await client.start_workflow(
|
||||
ToolWorkflow.run,
|
||||
combined_input,
|
||||
id=workflow_id,
|
||||
task_queue="agent-task-queue",
|
||||
start_signal="user_prompt",
|
||||
start_signal_args=[prompt],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python send_message.py '<prompt>'")
|
||||
print("Example: python send_message.py 'I want an event in Oceania this March'")
|
||||
else:
|
||||
asyncio.run(main(sys.argv[1]))
|
||||
Reference in New Issue
Block a user