mirror of
https://github.com/MervinPraison/PraisonAI.git
synced 2026-11-07 12:47:55 -10:00
Added multiple examples demonstrating the creation and management of agents, environments, sessions, and custom tools in the managed agents architecture. This comprehensive set of examples now includes functionalities such as tool selection, disabling tools, and updating agent configurations, providing users with clear guidance on utilizing the framework effectively.
24 lines
607 B
Python
24 lines
607 B
Python
from praisonai import Agent, ManagedAgent, ManagedConfig
|
|
|
|
managed = ManagedAgent(
|
|
config=ManagedConfig(
|
|
name="Session Demo Agent",
|
|
model="claude-haiku-4-5",
|
|
system="You are a helpful assistant.",
|
|
),
|
|
)
|
|
|
|
agent = Agent(name="session-demo", backend=managed)
|
|
|
|
# Run a task to create agent + session
|
|
agent.start("Say hello briefly")
|
|
|
|
# List sessions for this agent
|
|
sessions = managed.list_sessions()
|
|
print(f"Total sessions: {len(sessions)}")
|
|
for s in sessions[:5]:
|
|
print(f" ID: {s['id']}")
|
|
print(f" Status: {s['status']}")
|
|
print(f" Title: {s['title']}")
|
|
print()
|