from upsonic import Agent, Task, Team
legal_expert = Agent(
model="anthropic/claude-sonnet-4-5",
name="Legal Expert",
role="Legal Advisor",
goal="Provide legal guidance and compliance information",
system_prompt="You are an expert in corporate law and regulations",
)
tech_expert = Agent(
model="anthropic/claude-sonnet-4-5",
name="Tech Expert",
role="Technology Specialist",
goal="Provide technical solutions and architecture advice",
system_prompt="You are an expert in software architecture and cloud systems",
)
tech_team = Team(
entities=[tech_expert],
mode="sequential",
name="TechTeam",
)
team = Team(
entities=[legal_expert, tech_team],
mode="route",
model="anthropic/claude-sonnet-4-5",
)
tasks = [
Task(description="What are the best practices for implementing OAuth 2.0?"),
Task(description="How should we handle token refresh securely?"),
]
for chunk in team.stream(tasks):
print(chunk, end="", flush=True)