Manual Coding provides maximum flexibility and is ideal when built-in tools are insufficient or custom logic is required.
Tool Structure
Every Python tool in Dev Studio follows a standard execution pattern with a single entrypoint:Parameters
inputs
A dictionary containing values from session variable (user_variables, capture_variables) Example:env_variables
A dictionary containing environment variables, secrets, API keys, and configuration values. Example:Return Format
The script must return a dictionary with the following structure:output
Theoutput object is returned directly to the agent and can be:
- Displayed to users
- Used in prompts
- Passed to downstream workflow steps
- Consumed by other agents
captured_variables
Values insidecaptured_variables are automatically stored as session variables and become available throughout the workflow.
Example:
Example Tool
The following example generates appointment slots based on user preferences:Best Practices
Keep Business Logic Separate
Move complex logic into helper functions rather than placing everything insidemain().
Handle Errors Gracefully
Always wrap execution in atry/except block and return meaningful error messages.
Return Structured Data
Prefer dictionaries and arrays over plain text so downstream agents can reliably consume the output.Capture Reusable Values
Store frequently reused values incaptured_variables.
Use Environment Variables for Secrets
Never hardcode API keys, credentials, or secrets in your code.Common Use Cases
- Calling external APIs
- Database queries
- Data transformation
- Custom business rules
- File processing
- SSH and Running commands
- Validation and enrichment pipelines

