Skip to content

TaskContext API reference

Inside a tool’s process(self, input, ctx), the ctx object (TaskContext) is the tool’s only channel to the platform. The worker never talks to the database, billing, or storage directly — it calls ctx.* and the WorkerFleet does the rest. Authoritative signatures live in soundverse-py (src/soundverse/tools/context.py).

Method What it does
ctx.emit_progress(pct, msg) Push a progress update (percent + message) to the client
ctx.emit_partial(data) Emit a partial/interim result during a long generation
ctx.set_streaming_url(url) Publish a live streaming URL (e.g. an HLS preview) for the task
ctx.log(msg) Structured worker log line (surfaces in SigNoz)
Method What it does
ctx.upload_file(...) Upload a produced file to core-storage (content-deduped, task-scoped) — returns a file_id
ctx.add_asset(...) Attach an asset (e.g. a song card) to the chat/message stream
ctx.set_license(...) Record the license applied to a produced file
ctx.live_audio_ingest(...) Feed a realtime audio stream into the live-to-VOD pipeline
Method What it does
ctx.report_usage(units) Report raw usage — core-mcp prices and settles; the worker never bills
ctx.resolve_credentials() Resolve the tool’s provider credentials (from ToolCredentials.secret_ref)
Property What it is
ctx.user_id The requesting user
ctx.workspace_id The active workspace
ctx.project_id The project the task belongs to
Method What it does
ctx.list_messages() Load prior conversation turns (used by the agent for history/dedup)