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

The output 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
Example:

captured_variables

Values inside captured_variables are automatically stored as session variables and become available throughout the workflow. Example:
These variables can be referenced by subsequent agents, tools, and workflow steps during the active session.

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 inside main().

Handle Errors Gracefully

Always wrap execution in a try/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 in captured_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

Testing

See Testing Tools.