mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-16 22:48:09 +01:00
documentation & guidance updates, getting things done, fixing a possible NDE if you change env vars, changes to enable user picking "done", minor test changes, minor goal selection prompt improvements
This commit is contained in:
@@ -5,7 +5,7 @@ from temporalio.worker import Worker
|
||||
from temporalio.testing import TestWorkflowEnvironment
|
||||
from api.main import get_initial_agent_goal
|
||||
from models.data_types import AgentGoalWorkflowParams, CombinedInput
|
||||
from workflows import AgentGoalWorkflow
|
||||
from workflows.agent_goal_workflow import AgentGoalWorkflow
|
||||
from activities.tool_activities import ToolActivities, dynamic_tool_activity
|
||||
|
||||
|
||||
@@ -17,12 +17,7 @@ async def asyncTearDown(self):
|
||||
# Clean up after tests
|
||||
await self.env.shutdown()
|
||||
|
||||
async def test_workflow_success(client: Client):
|
||||
# Register the workflow and activity
|
||||
# self.env.register_workflow(AgentGoalWorkflow)
|
||||
# self.env.register_activity(ToolActivities.agent_validatePrompt)
|
||||
# self.env.register_activity(ToolActivities.agent_toolPlanner)
|
||||
# self.env.register_activity(dynamic_tool_activity)
|
||||
async def test_flight_booking(client: Client):
|
||||
|
||||
task_queue_name = "agent-ai-workflow"
|
||||
workflow_id = "agent-workflow"
|
||||
@@ -37,16 +32,19 @@ async def test_workflow_success(client: Client):
|
||||
|
||||
workflow_id = "agent-workflow"
|
||||
async with Worker(client, task_queue=task_queue_name, workflows=[AgentGoalWorkflow], activities=[ToolActivities.agent_validatePrompt, ToolActivities.agent_toolPlanner, dynamic_tool_activity]):
|
||||
|
||||
# todo set goal categories for scenarios
|
||||
handle = await client.start_workflow(
|
||||
AgentGoalWorkflow.run, id=workflow_id, task_queue=task_queue_name
|
||||
)
|
||||
# todo fix signals
|
||||
await handle.signal(AgentGoalWorkflow.submit_greeting, "user1")
|
||||
await handle.signal(AgentGoalWorkflow.submit_greeting, "user2")
|
||||
# todo send signals based on
|
||||
await handle.signal(AgentGoalWorkflow.user_prompt, "book flights")
|
||||
await handle.signal(AgentGoalWorkflow.user_prompt, "sydney in september")
|
||||
assert WorkflowExecutionStatus.RUNNING == (await handle.describe()).status
|
||||
|
||||
await handle.signal(AgentGoalWorkflow.exit)
|
||||
assert ["Hello, user1", "Hello, user2"] == await handle.result()
|
||||
|
||||
#assert ["Hello, user1", "Hello, user2"] == await handle.result()
|
||||
await handle.signal(AgentGoalWorkflow.user_prompt, "I'm all set, end conversation")
|
||||
assert WorkflowExecutionStatus.COMPLETED == (await handle.describe()).status
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user