agent.run
action executes a single AI agent to perform a specific, straightforward task within your workflow. It’s designed for simple, non-interactive operations that don’t require iteration or user feedback, making it perfect for preparation steps, analysis tasks, and single-purpose operations.
Overview
Theagent.run
action is ideal for tasks where you need a single agent to complete a specific job and provide output that can be used by subsequent workflow steps. Unlike agent.session
, it doesn’t maintain an ongoing conversation or coordinate multiple agents - it simply runs the specified agent with your instructions and completes the task.
Single Agent Execution
Runs one specific agent with focused instructions for a single task.
Non-Interactive
Completes the task without waiting for user input or maintaining a session.
Fast Execution
Optimized for quick, straightforward tasks that don’t require iteration.
Output Sharing
Provides structured output that can be referenced by subsequent workflow steps.
When to Use Agent Run
Perfect For
- Preparation tasks: Analyzing code, generating plans, extracting information
- Simple analysis: Code review preparation, dependency analysis, configuration parsing
- Data extraction: Parsing logs, extracting metrics, summarizing content
- Single-purpose operations: Formatting, validation, transformation tasks
- Quick decisions: Simple classification, routing, or decision-making
Not Suitable For
- Complex, multi-step tasks that require coordination between multiple agents
- Interactive workflows that need user feedback or ongoing conversation
- Tasks requiring iteration or multiple rounds of refinement
- Multi-agent collaboration where different agents need to work together
Basic Usage
Simple Agent Execution
The most basic usage runs a single agent:With Instructions
Provide specific instructions for the agent:Using Dynamic Values
Reference values from previous steps or triggers:Parameters
Required Parameters
The unique identifier of the agent to execute. This agent will be responsible for completing the specified task.
Specific instructions for the agent to follow. This should be clear, actionable guidance for the task at hand.
How It Works
1. Agent Selection
The system loads the specified agent configuration, including:- Selected agent (e.g., Senior Developer, Product Manager)
- Available tools and capabilities
- Custom instructions and configuration
2. Task Execution
The agent executes the task by:- Processing instructions and understanding the requirements
- Using available tools to gather information and perform actions
- Generating output based on the task requirements
- Completing execution when the task is finished
3. Output Generation
The agent provides structured output that can include:- Text responses with analysis, recommendations, or results
- Structured data in JSON format for downstream processing
- Tool outputs from any tools used during execution
- Status information about task completion
4. Workflow Continuation
The workflow continues to the next step with:- Agent output available for reference
- Context preserved for subsequent steps
- No ongoing session to maintain
Complete Examples
Code Review Preparation
Prepare a structured review plan for a pull request:Issue Analysis
Analyze a Jira issue and provide technical context:Dependency Analysis
Analyze project dependencies and identify updates:Output and Context
Step Output
Theagent.run
action provides output that can be used by subsequent steps:
The main output content from the agent, typically containing the task results, analysis, or generated content.
Available Variables
Use these variables in subsequent steps:{{outputs.analyze-code.message}}
: Main output from the agent
Template Examples
Basic Output Reference:Integration with Other Actions
Following with Agent Session
Useagent.run
to prepare input for more complex agent.session
workflows:
Data Processing Pipeline
Chain multipleagent.run
steps for data processing:
Best Practices
1. Keep Instructions Clear and Focused
- Single purpose: Each
agent.run
step should have one clear objective - Specific guidance: Provide detailed, actionable instructions
- Expected output: Clarify what format or structure you expect
- Context: Include relevant information from previous steps
2. Choose the Right Agent
- Match skills: Select agents with appropriate expertise for the task
- Consider tools: Ensure the agent has access to necessary tools
- Base agent type: Use built-in agent types that match your needs
- Custom agents: Leverage specialized agents for domain-specific tasks
3. Optimize for Output Reusability
- Structured output: Request output in formats that downstream steps can use
- Clear formatting: Ask for numbered lists, JSON, or other structured formats
- Key information: Focus on actionable insights and data
- Error handling: Consider what happens if the agent fails
4. Position in Workflow
- Early steps: Use for preparation and analysis tasks
- Data processing: Chain multiple steps for complex data workflows
- Input preparation: Prepare data for more complex
agent.session
steps - Validation: Use for checking and validating workflow state
Next Steps
Now that you understand theagent.run
action, explore these related topics:
- Agent Session Action: Learn about multi-agent, interactive workflows
- Agent Differences: Understand when to use each agent action type
- Building Blocks: Explore other workflow actions and components
- Quick Starts: See complete workflow examples
agent.run
for straightforward operations, then combine it with other actions to build powerful, automated workflows.