Skip to main content

Davinci Python SDK

Official Python SDK for Davinci's public API.

Install

pip install celedon-davinci-sdk

Quick Start

from davinci_sdk import DavinciClient

with DavinciClient(api_key="dav_ak_live_...", base_url="https://davinci-app.com") as client:
    project = client.projects.create(name="Spacecraft")
    opened = client.projects.open(project.id, branch="main")
    print(opened.branch_name, opened.already_loaded)
    client.projects.close(project.id)

For a full lifecycle walkthrough:

DAVINCI_API_KEY=dav_ak_live_... python examples/project_lifecycle.py

Namespaces

Namespace What it covers
client.projects Project lifecycle, branches and packages listings, file listing and download
client.organizations Read-only discovery of organizations available to team operations
client.content The parts tree, individual objects, adding or deleting objects, and exporting an object to a file
client.branches Creating and deleting branches, committing, uncommitted changes, object history
client.sessions Sessions, and through them the data plane for file transfer and the agent
client.cards Flat Task Card search, lifecycle, details, comments, assignments, tags, and links
client.card_tags Project Task Card tag catalog
client.teams Operational teams, statuses, sprints, boards, reports, and charts

The agile workflow example uses an existing project and team, creates temporary card-planning data, reads a report, and cleans up:

DAVINCI_API_KEY=dav_ak_live_... \
DAVINCI_PROJECT_ID=... \
DAVINCI_TEAM_ID=... \
python examples/agile_workflow.py

Set DAVINCI_ORG_ID when the team is not in the first organization returned by client.organizations.list().

content and branches reach the running project, so they open it if it is closed and they see uncommitted work. projects.list_files reads the saved snapshot instead, so it works on a closed project and does not show a file attached since the last save.

Every object needs a parent, its own parent or the request's parent_id. MODEL_PACKAGE_ID is the top of the model and LIBRARY_PACKAGE_ID the Library; an object with no parent, or a parent that cannot hold it, is refused.

import uuid
from davinci_sdk import MODEL_PACKAGE_ID

client.content.add_objects(project.id, {
    str(uuid.uuid4()): {"type": "requirement", "name": "Dry mass under 500 kg"},
}, parent_id=MODEL_PACKAGE_ID)
result = client.branches.commit(project.id, "main", "Seed")
history = client.branches.get_object_history(project.id, object_id)

content.export_object produces the file the editor's Export menu would, such as a document as PDF or DOCX, and saves it to the project. It runs on the server, so nobody needs the project open:

exported = client.content.export_object(project.id, document_id, format="pdf")
print(exported.page_count)
pdf = client.projects.download_file(project.id, exported.file.id)

Project-card search uses a bounded opaque cursor. include_no_team and include_unassigned OR the corresponding null case with selected IDs inside that facet; separate facets remain ANDed. Team card lists, comments, and history use offset pagination:

page = client.cards.search(
    project_id,
    state="open",
    include_no_team=True,
    include_unassigned=True,
    sort="created_desc",
    limit=100,
)
if page.meta.next_cursor:
    next_page = client.cards.search(
        project_id,
        limit=page.meta.limit,
        cursor=page.meta.next_cursor,
    )

comments = client.cards.comments.list(project_id, card_id, limit=50, offset=0)
history = client.cards.history.list(project_id, card_id, limit=50, offset=0)
overview = client.teams.get_overview(org_id, team_id)
completed = client.teams.sprints.list_completed(org_id, team_id, limit=25)
available = client.teams.cards.search_available(
    org_id,
    team_id,
    query="bearing",
    project_ids=[project_id],
    limit=50,
)

Safe create retries

Project, card, comment, catalog-tag, team, team-status, and team-sprint creates accept idempotency_key. Reuse the same key only when retrying the same create after a timeout or network failure; the server returns the original result instead of repeating the mutation. Use a fresh key for a new create. Reusing a key with different request data returns IDEMPOTENCY_KEY_REUSED, and a create still in progress returns IDEMPOTENCY_REQUEST_IN_PROGRESS.

card = client.cards.create(
    project_id,
    "Inspect propulsion mount",
    resolution=None,
    idempotency_key="workflow-42-card",
)
client.cards.update(
    project_id,
    str(card.card.id),
    description="Ready for review",
    is_open=False,
    resolution="Inspection complete",
    expected_history_head_id=str(card.history_head_id),
)

Keys are scoped to the authenticated actor and may contain at most 255 characters. Supplying a key does not make unrelated mutations safe to retry.

The agent

A session is where the agent lives, because the agent acts on the open project a session holds. send_message returns as soon as the prompt is taken, so waiting for the result is a separate step:

with client.sessions.create(project.id, branch="main") as session:
    session.send_message("Add a mounting bracket for the avionics tray")
    state = session.wait_until_done()      # polls to a terminal status
    for entry in session.messages().messages:
        print(entry.role, entry.text)

A terminal status is not necessarily a good one — failed is terminal, and so is the paused a stop() produces — so read the status rather than assuming success. To run one tool with no model deciding anything, invoke_tool is deterministic and spends no LLM credits:

session.invoke_tool(toolbox="Core", tool="MakePackage", params={"name": "Avionics"})

Authentication

Use a Davinci personal access token. Reads require the projects:read scope, open/close, file deletes, object writes, commits, and branch creation require projects:write, and create/update/delete plus branch deletion require projects:manage. Sessions need sessions:manage, and directing the agent needs agent:message, which the project scopes do not confer.

Task Cards use a separate cards:read → cards:write → cards:manage scope ladder. Operational teams use teams:read → teams:write → teams:manage. Board card mutations require both teams:write and cards:write. Scopes only narrow access: every request is also checked against the token owner's current project, organization, and team permissions. The manage names describe the largest published API capability bundle in each ladder; they do not grant every domain permission or bypass live role-based authorization.

Card user links currently support the participant relation, card-to-card links support relates_to, depends_on, and dependency_of, and object links use related. Creating an object link additionally requires projects:read and live models:read; the server verifies the object in the selected Project branch and stores canonical name/type metadata rather than trusting caller labels. Replacing a card's complete tag set accepts at most 50 tags.

Team membership, invitations, self-leave, and accepted ownership transfer remain browser-only and are not part of the SDK.

Team board reads include effective action capabilities. A board Card is either full when the credential and live Project role both allow cards:read, or a bounded team-board-summary containing operational title, placement, lifecycle, assignee, and tag data. Description and resolution are omitted from summaries. Reports and chart routes additionally require the live teams:sprints:analysis:read permission.

An optional initial assignee on Card creation is validated and written in the same transaction as the Card and history. Sprint deletion rejects active or non-empty sprints; complete the sprint and move or remove every Card first. Team Card creation also accepts assignee_ids, tag_ids, and card_links; those relationships, Team placement, mentions, and history commit atomically. Available-card search is cursor-paginated across already-linked writable Projects and excludes Cards already on the Team.

Every card-affecting method accepts expected_history_head_id; bulk status, sprint, tag, and team methods accept expected_history_head_ids. Stale writes raise DavinciError with code CARD_HISTORY_CONFLICT and preserve the server-provided current head and recent activity. Team workflow statuses expose close_mode (off, deprecated legacy manual, or automatic), and client.teams.statuses.close_all(...) transactionally closes all open cards in any column. No status transition reopens a card or changes another team's placement.

is_open is the project-global card State; each placement has an independent team workflow Status. Closing changes State for every team without moving any Status. Optional Markdown resolution survives reopen. Search rows expose ordered team_statuses; card-list icons use the first status surviving active team/status filters and remain neutral when Closed or no eligible status exists. Creating a Task Card tag without color uses #FF9900.

Opening a project with an API key returns lifecycle confirmation only: the url and server_token a browser receives are withheld, so a key controls the lifecycle without reaching live project data.

Development

Generated OpenAPI client code lives in generated-client/; the public SDK wrapper lives in davinci_sdk/.

python -m pip install -e ".[dev]"
black --check davinci_sdk tests examples
pytest
mypy davinci_sdk
python -m build
python -m twine check dist/*

Full HTTP API docs live at https://docs.davinci-app.com/pages/api/introduction.

Metadata

Release files for celedon-davinci-sdk 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for celedon-davinci-sdk 0.2.0
File Size Uploaded Provenance Actions
celedon_davinci_sdk-0.2.0.tar.gz 260.7 kB Without provenance Details for celedon_davinci_sdk-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for celedon-davinci-sdk 0.2.0
File Interpreter ABI Platform Actions
celedon_davinci_sdk-0.2.0-py3-none-any.whl Python 3 none any Details for celedon_davinci_sdk-0.2.0-py3-none-any.whl

Total release size: 1.0 MB

Release files / celedon_davinci_sdk-0.2.0.tar.gz

Download URL celedon_davinci_sdk-0.2.0.tar.gz
Size 260.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8d9e2a1c916ffb13bac6ef00b436c1f4ab78cd990169603336c95acc8d3b5291
BLAKE2b-256 checksum
How to use checksums
9ff3c9dfe7714b9cb51637028c4ba18473e93439dfe0ef0baa9f1dce2e15f15d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / celedon_davinci_sdk-0.2.0-py3-none-any.whl

Download URL celedon_davinci_sdk-0.2.0-py3-none-any.whl
Size 760.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f96754ef6ae341a2da2d64eb1faf9899e73e03f202d165725f797254c2956cef
BLAKE2b-256 checksum
How to use checksums
7e3cad32c4ba7a29a4be97e60964adbd75b26536cfcf5c7238a3a341436f8b05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for celedon-davinci-sdk 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page