Build an agent with the SDK
Use a workspace SDK to configure an agent through the platform. A Thinkuter is the saved agent; a framework adapter selects its harness. The SDK is the client for the platform API. Selecting a different harness does not require moving provider credentials into your application.
Prepare access
Section titled “Prepare access”Use the Python SDK package provided for your workspace, paired with its API release. Obtain a scoped platform access token through your organisation’s supported ThinkuteID flow. Keep credentials in your local secret store and process environment, never in source or shared examples.
Select your tenant, project, an available framework adapter and a model from an active provider connection. The server checks access and framework availability even when creating a draft. A catalogue entry alone does not grant execution permission.
For the hosted platform the API base URL is https://api.platform.thinkute.ai. Use the administrator-supplied URL for a customer-hosted installation. A provider API key, MCP delegation token and Claude inference gateway key are different credentials; none replaces a platform access token.
Create a bounded private draft
Section titled “Create a bounded private draft”This Python example discovers the adapter’s current version pins, creates an instruction-backed private draft and reads it back. It selects no tools, disables session memory and sets an output ceiling of 128 tokens and a USD 0.01 model-policy ceiling. Creating the draft does not invoke a model or publish the agent.
Set these process environment variables to your own workspace selections:
| Variable | Value |
|---|---|
THINKUTER_ACCESS_TOKEN |
Scoped platform access token. |
THINKUTER_TENANT_ID, THINKUTER_PROJECT_ID |
Your tenant and project. |
THINKUTER_FRAMEWORK_ADAPTER_ID |
The exact available framework profile. |
THINKUTER_PROVIDER_CONNECTION_ID, THINKUTER_MODEL_ID |
Your approved source and model. |
THINKUTER_OPERATION_ID |
One UUID saved for this logical creation; reuse it on a retry. |
import osfrom uuid import UUID
from thinkuter_sdk import Thinkuterfrom thinkuter_sdk.generated.models import ( AgentReleaseStage, AgentSkillAttachment, AgentSkillAttachmentSource, AgentSkillManifest, AgentSkillManifestVersion, AgentVisibility, FrameworkAdapterStatus,)
tenant, project = os.environ["THINKUTER_TENANT_ID"], os.environ["THINKUTER_PROJECT_ID"]adapter_id = os.environ["THINKUTER_FRAMEWORK_ADAPTER_ID"]operation = UUID(os.environ["THINKUTER_OPERATION_ID"])client = Thinkuter( base_url="https://api.platform.thinkute.ai", token=os.environ["THINKUTER_ACCESS_TOKEN"], tenant_id=tenant,)try: adapter = client.get_framework_adapter(adapter_id) if (adapter.framework_adapter_id != adapter_id or adapter.tenant_id != tenant or adapter.project_id != project or adapter.status is not FrameworkAdapterStatus.ACTIVE): raise RuntimeError("Select an active adapter in this exact workspace.") pins = {field: getattr(adapter, field) for field in ( "adapter_contract_version", "adapter_implementation_version", "framework_version", "fabric_contract_version", )} if any(not isinstance(value, str) or not value.strip() for value in pins.values()): raise RuntimeError("The adapter must provide all four current pins.") source, model = os.environ["THINKUTER_PROVIDER_CONNECTION_ID"], os.environ["THINKUTER_MODEL_ID"] skills = AgentSkillManifest(version=AgentSkillManifestVersion.VALUE_1, skills=[ AgentSkillAttachment( skill_id="skill.arithmetic_example", title="Arithmetic", source=AgentSkillAttachmentSource.CUSTOM, instructions="Solve the arithmetic request and show a concise calculation.", ), ]) created = client.create_agent( project_id=project, name=f"example_{operation.hex}", display_name="Arithmetic", visibility=AgentVisibility.PRIVATE, release_stage=AgentReleaseStage.DRAFT, framework_name=adapter.name, framework_adapter_id=adapter_id, framework_config=pins, provider_connection_id=source, model_id=model, skill_manifest=skills, model_policy={"default_data_class": "internal", "max_output_tokens": 128, "max_cost_microunits": 10_000}, tool_policy={"mode": "deny_all", "allowed_tools": []}, session_policy={"memory_enabled": False}, idempotency=f"agent-draft:{operation}", ) saved = client.get_agent(created.agent_id) saved_pins = saved.framework_config.to_dict() if saved.framework_config else {} if (saved.agent_id != created.agent_id or saved.tenant_id != tenant or saved.project_id != project or saved.framework_adapter_id != adapter_id or saved.framework_name != adapter.name or saved.provider_connection_id != source or saved.model_id != model or saved.visibility is not AgentVisibility.PRIVATE or saved.release_stage is not AgentReleaseStage.DRAFT or any(saved_pins.get(key) != value for key, value in pins.items()) or saved.skill_manifest.to_dict() != skills.to_dict()): raise RuntimeError("Saved draft differs from the requested configuration.") print(saved.agent_id)finally: client.generated.get_httpx_client().close()Keep the same operation UUID after a timeout or lost response. Changing it means a new logical creation. Review the saved draft in the console before continuing. A policy ceiling is a configuration limit, not a bill or measured run cost.
Preview, publish and invoke
Section titled “Preview, publish and invoke”- Open the draft and inspect its model, instructions, framework versions and access limits.
- Run the workspace’s bounded preview against a small public task. Check both the answer and the recorded execution evidence. Resolve errors before treating the profile as qualified.
- Publish only after the server’s readiness and access checks pass. Draft creation and a successful preview do not publish automatically.
- Invoke the published agent through the supported workspace or client flow. Follow its run and trace; inspect actual token, cost and timing coverage instead of substituting estimates.
If framework selection is denied, choose an authorised available profile or ask an administrator to review access. Do not remove checks, guess version pins or claim an unavailable profile is ready.
Durable execution and recovery
Section titled “Durable execution and recovery”Framework checkpoints and a public run lifecycle are different capabilities. Do not assume that a framework’s checkpoint support supplies a general SDK resume operation. Use only recovery actions exposed for the specific run, and keep the original operation/run identity when reconciling an uncertain response.
Claims about restart recovery, exactly-once effects or harness reliability need fault-injection and hosted execution evidence for the selected versions. This draft example establishes configuration usage; it is not a reliability benchmark.
Agents and harnesses explains selection. Connections and tools explains account permissions, and Read the measurements explains evidence limits.