May 19th, 2026

Finally: Execute Your Python Code, Not Generated Code

Turn your Python functions into reliable agent skills. Define once, execute infinitely.

Until now, you had two choices: either let your agents generate Python code on-the-fly (flexible, but unpredictable), or manually write every integration. Neither was ideal.

You had solid Python code; tested code, code that works, but your agents couldn't use it directly.

We've created Python Code Execution: a way to turn your Python functions into reusable agent skills.

Here's how it works:

  1. You write a Python function (a real one, with your business logic)

  2. You deploy it as an agent skill in 2 minutes

  3. Your agents execute it whenever they need it, always the same way

No dynamic generation. No hallucinations. No surprises. Just your code.

What You Can Do Now

  • Currency conversion: Your agents convert amounts with live exchange rates, without asking you

  • Data validation: Normalize emails, phone numbers, addresses before they touch your database

  • Complex business logic: Calculate discounts, taxes, fees, exactly as your rules require

  • API integration: Wrap your API calls with authentication and error handling, then let agents use them

  • Data transformation: Clean, reformat, enrich data before sending it elsewhere

  • Structured reports: Aggregate and format data for presentation or automatic export

Technical Details

Your code runs in an isolated, secure environment:

  • Timeout: 30 seconds per execution (configurable by plan)

  • Memory: 512 MB per execution

  • Libraries: You have access to requests, pandas, numpy, json, datetime, and more

  • Errors: Smart handling, errors are captured and returned usefully

  • Traceability: Every execution is logged for audit and debugging

Get Started in 5 Minutes

  1. Open an agent (existing or new)

  2. Go to SkillsAdd a skill

  3. Select "Python Code Execution"

  4. Paste your Python function (e.g., a currency converter)

  5. Test with real data

  6. You're done.

Concrete Example:

def convert_currency(amount: float, from_currency: str, to_currency: str) -> str: import requests url = f"https://api.frankfurter.app/latest?amount={amount}&from={from_currency}&to={to_currency}" response = requests.get(url, timeout=10) data = response.json() converted = data["rates"][to_currency] return f"{amount} {from_currency} = {converted} {to_currency}" 

Save, test, it's live.

Python Code Execution vs. Python Code Interpreter : When to Use Which?

We also offer Python Code Interpreter (dynamic code generation). Here's the difference:

Code Execution

Code Interpreter

You define

The complete function

Just the task

Your agent

Executes it exactly

Generates it dynamically

Best for

Production, repetitive workflows

Exploration, one-off tasks

Control

Total (it's your code)

Limited (agent makes it up)

Use Code Execution if:

  • You have code that works and needs to stay stable

  • You need total control over the logic

  • It's for production (payments, sensitive data, etc.)

Use Code Interpreter if:

  • You're exploring, experimenting

  • Every request is different

  • You don't have predefined code

Availability

  • Pro plan and higher (Team Starter, Team Growth, Custom)

  • Not available on the free plan

  • Where to find it: Agents → [Your agent] → Edit → Skills → Add a skill → "Python Code Execution"

What This Changes for You

Before: You had Python code + your agents = two separate worlds.

Now: Your Python code = an agent skill = a complete, end-to-end workflow.

No more need to:

  • Rewrite your business logic

  • Ask your agents to generate risky code

  • Maintain two versions of the same logic

Just: Define once, execute infinitely.


"Ready to turn your Python code into an agent skill? Check out the documentation."

→ Discover at docs.swiftask.ai