Manual task assignment only works with the sequential team mode. In sequential mode, context is automatically shared between tasks, so each subsequent task can access the results of previous tasks.
Full Example Code
from upsonic import Agent, Task, Team
# Create specialized agents
writer = Agent(
model="anthropic/claude-sonnet-4-5",
name="Writer",
role="Content Writer",
goal="Create engaging content"
)
editor = Agent(
model="anthropic/claude-sonnet-4-5",
name="Editor",
role="Content Editor",
goal="Polish and improve content"
)
# Create team
team = Team(agents=[writer, editor], mode="sequential")
# Explicitly assign agents to tasks
task1 = Task(description="Write a product description")
task1.agent = writer # Force this task to use writer
task2 = Task(description="Edit and polish the description")
task2.agent = editor # Force this task to use editor
# Execute with manual assignments
result = team.print_do([task1, task2])
print(result)