Skip to content

Commit 2821042

Browse files
fix: all issues
1 parent 5e1f4ed commit 2821042

File tree

15 files changed

+1768
-337
lines changed

15 files changed

+1768
-337
lines changed

examples/tutorials/20_behavior_testing/000_basic_sync_testing/test_sync_agent.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
- AgentEx services running (make dev)
88
- A sync agent running (e.g., tutorial 00_sync/000_hello_acp)
99
10+
Setup:
11+
1. List available agents: agentex agents list
12+
2. Copy a sync agent name from the output
13+
3. Update AGENT_NAME below
14+
1015
Run:
1116
pytest test_sync_agent.py -v
1217
"""
@@ -18,10 +23,13 @@
1823
test_sync_agent,
1924
)
2025

26+
# TODO: Replace with your actual sync agent name from 'agentex agents list'
27+
AGENT_NAME = "s000-hello-acp"
28+
2129

2230
def test_sync_agent_responds():
2331
"""Test that sync agent responds to a simple message."""
24-
with test_sync_agent() as test:
32+
with test_sync_agent(agent_name=AGENT_NAME) as test:
2533
# Send a message
2634
response = test.send_message("Hello! How are you?")
2735

@@ -32,7 +40,7 @@ def test_sync_agent_responds():
3240

3341
def test_sync_agent_multi_turn():
3442
"""Test that sync agent handles multi-turn conversation."""
35-
with test_sync_agent() as test:
43+
with test_sync_agent(agent_name=AGENT_NAME) as test:
3644
# First exchange
3745
response1 = test.send_message("Hello!")
3846
assert_valid_agent_response(response1)
@@ -53,7 +61,7 @@ def test_sync_agent_multi_turn():
5361

5462
def test_sync_agent_context():
5563
"""Test that sync agent maintains conversation context."""
56-
with test_sync_agent() as test:
64+
with test_sync_agent(agent_name=AGENT_NAME) as test:
5765
# Establish context
5866
response1 = test.send_message("My name is Sarah and I'm a teacher")
5967
assert_valid_agent_response(response1)
@@ -70,7 +78,7 @@ def test_sync_agent_context():
7078

7179
def test_sync_agent_specific_content():
7280
"""Test that agent responds with expected content."""
73-
with test_sync_agent() as test:
81+
with test_sync_agent(agent_name=AGENT_NAME) as test:
7482
# Ask a factual question
7583
response = test.send_message("What is 2 plus 2?")
7684

@@ -85,7 +93,7 @@ def test_sync_agent_specific_content():
8593

8694
def test_sync_agent_conversation_length():
8795
"""Test conversation history tracking."""
88-
with test_sync_agent() as test:
96+
with test_sync_agent(agent_name=AGENT_NAME) as test:
8997
# Send 3 messages
9098
test.send_message("First message")
9199
test.send_message("Second message")

examples/tutorials/20_behavior_testing/010_agentic_testing/test_agentic_agent.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
66
Prerequisites:
77
- AgentEx services running (make dev)
8-
- An agentic agent running (e.g., tutorial 10_agentic)
8+
- An agentic agent running (e.g., tutorial 10_agentic/00_base/000_hello_acp)
9+
10+
Setup:
11+
1. List available agents: agentex agents list
12+
2. Copy an agent name from the output
13+
3. Update AGENT_NAME below
914
1015
Run:
1116
pytest test_agentic_agent.py -v
@@ -15,11 +20,14 @@
1520

1621
from agentex.lib.testing import assert_valid_agent_response, test_agentic_agent
1722

23+
# TODO: Replace with your actual agent name from 'agentex agents list'
24+
AGENT_NAME = "ab000-hello-acp"
25+
1826

1927
@pytest.mark.asyncio
2028
async def test_agentic_agent_responds():
2129
"""Test that agentic agent responds to events."""
22-
async with test_agentic_agent() as test:
30+
async with test_agentic_agent(agent_name=AGENT_NAME) as test:
2331
# Send event and wait for response
2432
response = await test.send_event("Hello! How are you?", timeout_seconds=15.0)
2533

@@ -31,7 +39,7 @@ async def test_agentic_agent_responds():
3139
@pytest.mark.asyncio
3240
async def test_agentic_agent_multi_turn():
3341
"""Test that agentic agent handles multi-turn conversation."""
34-
async with test_agentic_agent() as test:
42+
async with test_agentic_agent(agent_name=AGENT_NAME) as test:
3543
# First exchange
3644
response1 = await test.send_event("Hello!", timeout_seconds=15.0)
3745
assert_valid_agent_response(response1)
@@ -51,7 +59,7 @@ async def test_agentic_agent_multi_turn():
5159
@pytest.mark.asyncio
5260
async def test_agentic_agent_context():
5361
"""Test that agentic agent maintains conversation context."""
54-
async with test_agentic_agent() as test:
62+
async with test_agentic_agent(agent_name=AGENT_NAME) as test:
5563
# Establish context
5664
response1 = await test.send_event("My name is Jordan and I work in finance", timeout_seconds=15.0)
5765
assert_valid_agent_response(response1)
@@ -66,7 +74,7 @@ async def test_agentic_agent_context():
6674
@pytest.mark.asyncio
6775
async def test_agentic_agent_timeout_handling():
6876
"""Test proper timeout configuration for different scenarios."""
69-
async with test_agentic_agent() as test:
77+
async with test_agentic_agent(agent_name=AGENT_NAME) as test:
7078
# Quick question - short timeout
7179
response = await test.send_event("Hi!", timeout_seconds=10.0)
7280
assert_valid_agent_response(response)
@@ -76,7 +84,7 @@ async def test_agentic_agent_timeout_handling():
7684
@pytest.mark.asyncio
7785
async def test_agentic_agent_conversation_flow():
7886
"""Test natural conversation flow with agentic agent."""
79-
async with test_agentic_agent() as test:
87+
async with test_agentic_agent(agent_name=AGENT_NAME) as test:
8088
# Simulate a natural conversation
8189
messages = [
8290
"I need help with a Python project",
@@ -89,7 +97,7 @@ async def test_agentic_agent_conversation_flow():
8997
response = await test.send_event(msg, timeout_seconds=20.0)
9098
assert_valid_agent_response(response)
9199
responses.append(response)
92-
print(f"✓ Exchange {i+1}/3 complete")
100+
print(f"✓ Exchange {i + 1}/3 complete")
93101

94102
# All exchanges should succeed
95103
assert len(responses) == 3

0 commit comments

Comments
 (0)