The upload function sends traced events and optional evaluation data to Synth’s backend for analysis. It works in conjunction with the logging mode set via environment variables.

Logging Modes

Deferred Mode

Set as an environment variable:

export SYNTH_LOGGING_MODE="deferred"

This mode stores traces in memory until explicitly uploaded:

  • Traces are held in memory until upload() is called
  • Supports batching multiple agent runs
  • Required for uploading questions and reward signals
  • Ideal for evaluation runs with scoring data

Instant Mode

Set as an environment variable:

export SYNTH_LOGGING_MODE="instant"

This mode provides immediate trace uploads:

  • Traces are sent as soon as each decorated method completes
  • No need to call upload()
  • Lower memory usage
  • Faster for single runs
  • Cannot include questions or reward signals
  • Default mode if not specified

Usage

from synth_sdk import upload
from synth_sdk.tracing.abstractions import Dataset, TrainingQuestion, RewardSignal
import uuid

# Create dataset (required, but can be empty)
dataset = Dataset(
    questions=[
        TrainingQuestion(
            id=str(uuid.uuid4()),
            intent="Solve a math problem",
            criteria="Correct numerical answer with work shown"
        )
    ],
    reward_signals=[
        RewardSignal(
            question_id=question_id,
            system_instance_id=agent.system_instance_id,
            reward=1.0,
            annotation="Correct answer provided"
        )
    ]
)

# Upload traces and dataset
upload_id, questions, rewards, traces = upload(dataset=dataset)

Parameters

  • dataset (Dataset, required): Contains questions and reward signals
    • Can be initialized with empty lists: Dataset(questions=[], reward_signals=[])
  • verbose (bool, optional): Enable detailed logging

Common Usage Patterns

Most customers use:

  • Instant mode in production for real-time tracking
  • Deferred mode for evaluation runs where they have:
    • Specific test questions
    • Automated scoring systems
    • Multiple agent runs to batch

Note: All Synth products support data uploaded without questions or reward signals. These are optional enrichments that can improve agent optimization results.