FruxonDocs

Python SDK

Install and use the Fruxon Python SDK to execute agents programmatically

The Fruxon Python SDK lets you execute agents from your Python code and from the command line.

Installation

pip install fruxon

Authentication

You need an API key and your tenant identifier. Generate an API key from your Settings page.

Python Client

from fruxon import FruxonClient

client = FruxonClient(api_key="frx_...", tenant="acme-corp")

result = client.execute("support-agent", parameters={"question": "How do I reset my password?"})
print(result.response)

Execution Result

The execute() method returns an ExecutionResult with these fields:

FieldTypeDescription
responsestrThe agent's text response
session_idstrSession ID for multi-turn conversations
execution_record_idstrUnique ID for this execution
traceExecutionTraceCost and performance metadata
linkslistRelated links returned by the agent

The trace object contains:

FieldTypeDescription
agent_idstrAgent identifier
agent_revisionintRevision number used
durationintExecution time in milliseconds
input_costfloatInput token cost (USD)
output_costfloatOutput token cost (USD)
total_costfloatTotal cost (USD)

Multi-Turn Conversations

Pass the session_id from a previous result to continue a conversation:

result = client.execute("support-agent", parameters={"question": "What's your return policy?"})

# Continue the conversation
follow_up = client.execute(
    "support-agent",
    parameters={"question": "What about international orders?"},
    session_id=result.session_id,
)

Error Handling

The SDK raises typed exceptions for different error scenarios:

from fruxon import FruxonClient
from fruxon.exceptions import AuthenticationError, NotFoundError, FruxonConnectionError

client = FruxonClient(api_key="frx_...", tenant="acme-corp")

try:
    result = client.execute("my-agent", parameters={"input": "Hello"})
except AuthenticationError:
    print("Invalid API key")
except NotFoundError:
    print("Agent not found")
except FruxonConnectionError:
    print("Could not reach the Fruxon API")
ExceptionWhen
AuthenticationErrorInvalid or missing API key (401)
ForbiddenErrorInsufficient permissions (403)
NotFoundErrorAgent or tenant not found (404)
ValidationErrorInvalid parameters (400/422)
FruxonConnectionErrorNetwork error

CLI

The SDK also installs a fruxon command for running agents from the terminal.

Execute an Agent

fruxon run <agent> --tenant <tenant> --api-key <key>

You can set the API key as an environment variable instead:

export FRUXON_API_KEY=frx_...
fruxon run my-agent -t acme-corp

Pass Parameters

fruxon run my-agent -t acme-corp -p question="Hello" -p lang=en

JSON Output

Use --json to get the full response as JSON, useful for scripting:

fruxon run my-agent -t acme-corp --json

Export a Code Agent

If you've built an agent in Python using LangChain, CrewAI, Google ADK, or another framework, you can consolidate it into a single file for importing into Fruxon:

# Auto-detect and copy to clipboard
fruxon export --copy

# Write to file
fruxon export -o export.py

fruxon export scans your project for framework imports, traces all local dependencies using Python's AST, and outputs a single consolidated file.

On this page