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:
Tersefor runtime job registration@app.job(...)for declaring jobsTerseAgentfor 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, Terse
from terse_sdk.types.stream_events import SdkAgentStreamEventFinalOutput
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 = (
"Answer with one short, cute sentence about this cron job. "
f"Context: {event.formatted_content}"
)
for stream_event in agent.run(prompt, event):
if isinstance(stream_event, SdkAgentStreamEventFinalOutput):
print(stream_event.finalOutput)
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.attioandagent.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)
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
- Homepage: useterse.ai
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file terse_sdk-0.1.5.tar.gz.
File metadata
- Download URL: terse_sdk-0.1.5.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e2f987c7aea95237cc91aff8f79bb0e6d3e3491ca17f70d2383c912c969fd74
|
|
| MD5 |
7b6e82610748a9615c2c15f77f42e21c
|
|
| BLAKE2b-256 |
b354309667ffed468023256192f72ae19cea84fbec43d25eacacad827e45edeb
|
File details
Details for the file terse_sdk-0.1.5-py3-none-any.whl.
File metadata
- Download URL: terse_sdk-0.1.5-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
321e68d82abe24910279d8be087abbe3c33c732764b47f41372ceca556c44dab
|
|
| MD5 |
a7f4ac84c51d564711ab2bc94ea0c557
|
|
| BLAKE2b-256 |
105571641c6bcf9f3bae0abfd370ce997ff4f905f7978a862badfd850947ae18
|