-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy path11_multi_turn.py
More file actions
25 lines (21 loc) · 792 Bytes
/
Copy path11_multi_turn.py
File metadata and controls
25 lines (21 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from praisonai import Agent, ManagedAgent, ManagedConfig
managed = ManagedAgent(
config=ManagedConfig(
name="Multi Turn Agent",
model="claude-haiku-4-5",
system="You are a helpful coding assistant.",
),
)
agent = Agent(name="multi-turn", backend=managed)
print(f"Session ID: {managed.session_id}")
# Multi-turn: each call reuses the same session — agent remembers context
messages = [
"Create a file called greeting.py that prints 'Hello World'",
"Now modify greeting.py to accept a name as a command line argument",
"Run greeting.py with the argument 'Claude'",
]
for i, message in enumerate(messages):
print(f"\n--- Turn {i + 1}: {message} ---\n")
result = agent.start(message)
print(result)
print("\nAgent finished turn.")