Skip to main content

Python SDK for building jobs on the Terse platform.

Project description

terse-sdk

Python SDK for building jobs on the Terse platform.

Most users should start with terse-cli, which scaffolds a project and generates terse_generated.py helpers for the currently supported trigger and skill surface.

Installation

python -m pip install terse-sdk

Runtime API

The SDK provides:

  • Terse for runtime job registration
  • @app.job(...) for declaring jobs
  • TerseAgent for agent runs and deterministic tool execution
  • typed event models such as CronJobInputEvent
  • hand-written request/response models exported from terse_sdk

Quick Start

from terse_sdk import CronJobInputEvent, SdkAgentStreamEventFinalOutput, Terse
from terse_generated import Schedule, TerseAgent

app = Terse()

@app.job(
    name="example-job",
    triggers=[Schedule.cron("0 9 * * 1")],
    skills=[],
)
def run_job(event: CronJobInputEvent, agent: TerseAgent) -> None:
    prompt = (
        "Tell a joke"
        f"Context: {event.formatted_content}"
    )
    for stream_event in agent.run(prompt, event):
        if isinstance(stream_event, SdkAgentStreamEventFinalOutput):
            print(stream_event.final_output)

Trigger and skill configs come from the generated helpers in terse_generated.py. Run terse init and terse generate to scaffold a project.

Generated Helpers

The SDK package does not generate project helpers by itself.

If you scaffold a project with terse init and then run terse generate, your project gets src/terse_generated.py with the currently supported helpers:

  • Schedule.cron(...)
  • Attio.skill(...)
  • Snowflake.skill(...)
  • deterministic wrappers on agent.tools.attio and agent.tools.snowflake

Example inside a generated project:

from terse_generated import Schedule, Snowflake, TerseAgent
from terse_sdk import CronJobInputEvent, Terse

app = Terse()

@app.job(
    name="snowflake-job",
    triggers=[Schedule.cron("0 9 * * 1")],
    skills=[Snowflake.skill()],
)
def example(event: CronJobInputEvent, agent: TerseAgent) -> None:
    result = agent.tools.snowflake.execute_query(query="select current_date()")
    print(result)

Local Development

To test local changes to the SDK in a Terse project, you need to add a uv source override so the resolver uses your local copy instead of PyPI.

From your project directory, run:

link-terse-py

This adds a [tool.uv.sources] entry to your pyproject.toml pointing at the local SDK and runs uv sync:

[tool.uv.sources]
terse-sdk = { path = "/path/to/Terse/packages/terse-python-sdk", editable = true }

To revert back to the published PyPI version:

unlink-terse-py

Why not uv pip install -e? uv manages dependencies declaratively from pyproject.toml + uv.lock. An imperative uv pip install -e gets overwritten the next time uv sync or uv run re-resolves from the lockfile. The source override tells uv's resolver itself to use the local path, so it persists across syncs.

Environment Variables

  • TERSE_API_KEY: required for agent runs and deterministic tool execution

Recommended Path

If you want the full project workflow, install the CLI instead:

python -m pip install terse-cli
terse init my-terse-job

Source

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

terse_sdk-0.1.10.tar.gz (33.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

terse_sdk-0.1.10-py3-none-any.whl (35.9 kB view details)

Uploaded Python 3

File details

Details for the file terse_sdk-0.1.10.tar.gz.

File metadata

  • Download URL: terse_sdk-0.1.10.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for terse_sdk-0.1.10.tar.gz
Algorithm Hash digest
SHA256 e3b7d3e5341e97fa11b089e34aa14b4a66b836c02087b851ebf2bd44fbc68671
MD5 b7549a91d53fdc90393fe2c5ec670d43
BLAKE2b-256 a3f13b727e391b42ca375ff090de2b50795b595b085e9e6a7d2da5958d4b6109

See more details on using hashes here.

File details

Details for the file terse_sdk-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: terse_sdk-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 35.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for terse_sdk-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a15ae69da40731a6d24684696efb574c5b9edfddbe96f04eb24cf5fee7647708
MD5 5594c31672b14b99f23f097b400eb6f7
BLAKE2b-256 0da109a736e295df4f0b14457fe3ae8f2cb799fd484692d33654cd2b0022275c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page