agent.run
and agent.session
is crucial for designing effective Overcut workflows. Each action type serves different purposes and has distinct characteristics that make them suitable for specific scenarios.
Overview
Overcut provides two distinct agent action types that serve different workflow needs:agent.run
: Single-agent execution for straightforward, non-interactive tasksagent.session
: Multi-agent coordination for complex, interactive workflows
Agent Run
Single agent, focused execution, quick completion
Agent Session
Multiple agents, coordination, ongoing interaction
Key Differences
Execution Model
Agent Run
- Single agent execution: One specific agent handles the entire task
- Direct execution: Agent works independently without coordination
- Linear workflow: Task is completed in a single pass
- Background operation: No ongoing conversation or user interaction
Agent Session
- Multi-agent coordination: Multiple agents work together under a coordinator
- Coordinated execution: Coordinator agent orchestrates the workflow
- Iterative process: Tasks can be refined and repeated
- Interactive session: Maintains ongoing conversation and user feedback
Agent Behavior
Agent Run
- Works independently without delegation capabilities
- Executes tools directly to complete the assigned task
- Reports completion when the task is finished
- Cannot coordinate with other agents
- Operates in background without user interaction
Agent Session
- Breaks down complex tasks into smaller, manageable pieces
- Delegates subtasks to specialized agents
- Reviews results and provides feedback to agents
- Manages iteration and refinement cycles
- Communicates progress to users throughout the process
Task Complexity
Agent Run
- Simple, focused tasks: Single objective with clear requirements
- No iteration needed: Task can be completed in one attempt
- Independent execution: No coordination between different aspects
- Quick completion: Designed for fast, straightforward operations
Agent Session
- Complex, multi-faceted tasks: Multiple objectives requiring different expertise
- Iteration and refinement: Plans can be adjusted based on results
- Coordinated execution: Different agents handle different aspects
- Extended duration: Designed for longer, more complex workflows
When to Use Each Action
Choose Agent Run When
- Task is straightforward and can be completed by one agent
- No coordination needed between different areas of expertise
- Quick execution is required without ongoing interaction
- Single output is needed for downstream workflow steps
- Preparation tasks that provide input for more complex workflows
- Code analysis and preparation
- Data extraction and parsing
- Simple validation tasks
- Generating plans or summaries
- Single-purpose operations
Choose Agent Session When
- Task requires multiple perspectives or areas of expertise
- Coordination is essential between different aspects
- Iteration and refinement are needed
- User interaction would be beneficial
- Complex problem-solving that benefits from collaboration
- Comprehensive code reviews
- Architecture design and planning
- Multi-repository analysis
- Incident investigation and resolution
- Feature implementation planning
Workflow Design Patterns
Pattern 1: Preparation → Execution
Useagent.run
to prepare input for complex agent.session
workflows:
Pattern 2: Multi-Stage Processing
Chain multipleagent.run
steps for data processing pipelines:
Pattern 3: Complex Coordination
Useagent.session
for tasks requiring multiple perspectives:
Performance and Resource Considerations
Agent Run
Advantages:- Faster execution: Single agent, no coordination overhead
- Lower resource usage: No session management or ongoing conversation
- Predictable timing: Linear execution with known completion time
- Easier debugging: Single execution path to trace
- Single perspective: Limited to one agent’s expertise
- No iteration: Cannot refine approach based on results
- Limited complexity: Not suitable for multi-faceted tasks
Agent Session
Advantages:- Multiple perspectives: Leverages different areas of expertise
- Iterative improvement: Can refine and adjust approach
- User interaction: Supports ongoing feedback and guidance
- Complex problem-solving: Handles multi-faceted challenges
- Longer execution time: Coordination and iteration add overhead
- Higher resource usage: Session management and ongoing conversation
- Complex debugging: Multiple execution paths and agent interactions
- Potential for coordination issues: Depends on coordinator effectiveness
Decision Framework
Step-by-Step Decision Process
-
Assess Task Complexity
- Is this a single, focused task?
- Does it require multiple areas of expertise?
- Is coordination between different aspects needed?
-
Consider Iteration Needs
- Can the task be completed in one attempt?
- Would refinement and adjustment be beneficial?
- Is ongoing user feedback valuable?
-
Evaluate Resource Constraints
- What’s the acceptable execution time?
- Are there resource limitations?
- What’s the priority of the task?
-
Determine User Interaction
- Is ongoing user guidance needed?
- Would real-time feedback improve results?
- Is this a collaborative or autonomous task?
Best Practices
For Agent Run
- Keep tasks focused: Single objective with clear requirements
- Provide clear instructions: Detailed, actionable guidance
- Choose appropriate agents: Match agent skills to task requirements
- Optimize output: Structure output for downstream consumption
- Handle errors gracefully: Plan for potential failures
For Agent Session
- Define clear goals: Specific, measurable objectives
- Choose complementary agents: Diverse expertise without overlap
- Set appropriate exit criteria: Time limits and user signals
- Enable user interaction: Use comment listening and session persistence
- Monitor coordination: Ensure effective delegation and feedback
Next Steps
Now that you understand the differences betweenagent.run
and agent.session
, explore these related topics:
- Agent Run Action: Learn about single-agent execution
- Agent Session Action: Learn about multi-agent coordination
- Building Blocks: Explore other workflow actions and components
- Quick Starts: See complete workflow examples
agent.run
for simple tasks, then evolve to agent.session
when you need coordination and collaboration. The key is matching the action type to your specific requirements and constraints.