Skip to main content

Python client for seegraph-core

Project description

seegraph-client

Python client for seegraph-core.

Install

pip install seegraph-client

Quickstart

Agent loop (without MCP)

from seegraph_client import AsyncSeegraphClient, StackTraceEntry

sg = AsyncSeegraphClient(url="http://localhost:8000")

# Traverse the knowledge hierarchy
result = await sg.think.query("how do we handle NDA renewals?")
print(result.node_path)           # e.g. ["Sales", "Enterprise"]
print(result.skills_activated)    # list of Skill objects

# Record reference resolution (use_reference equivalent)
await sg.stack_traces.append_entry(
    result.stack_trace_id,
    StackTraceEntry(depth=-1, node="Renewal Script", decision="activate", rationale="Resolved reference"),
)

# Submit new knowledge, linked back to this traversal
await sg.queue.submit(
    summary="NDAs over $500k require legal sign-off",
    processes=[{"name": "NDA Review", "description": "Review process for high-value NDAs"}],
    stack_trace_id=result.stack_trace_id,
    agent_id="my-agent-v1",
)

Approver workflow

from seegraph_client import SeegraphClient, SeegraphNotFoundError

with SeegraphClient(url="http://localhost:8000") as sg:
    try:
        plan = sg.plans.pending()
        print(f"Plan {plan.id}: {len(plan.operations)} operations")
        approved = sg.plans.approve(plan.id)
        print(f"Applied: {approved.status}")
    except SeegraphNotFoundError:
        print("No plan pending review")

Resources

Resource Methods
client.think query(prompt)
client.queue submit(summary, processes, raw_transcript?, stack_trace_id?, agent_id?), status(), flush()
client.plans list(status?), get(id), pending(), approve(id), defer(id), defer_submission(plan_id, sub_id), rollback(id), delete(id)
client.nodes get(node_id, include?), subtree(node_id?, depth?), children(node_id)
client.stack_traces get(trace_id), append_entry(trace_id, entry)

Both SeegraphClient (sync) and AsyncSeegraphClient (async) provide identical resources.

Error handling

from seegraph_client import SeegraphNotFoundError, SeegraphServerError

try:
    plan = sg.plans.get("bad-id")
except SeegraphNotFoundError as e:
    print(e.status_code, e.request_url)
except SeegraphServerError as e:
    print(e.raw_body)

Development

pip install -e ".[dev]"
python -m pytest
ruff check seegraph_client/ tests/

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

seegraph_client-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

seegraph_client-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file seegraph_client-0.1.0.tar.gz.

File metadata

  • Download URL: seegraph_client-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for seegraph_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e392ee6b9cb33b26fc1f01f09f70369f81f0b1d9064949318d4c157465af4073
MD5 66030b84dad79a81655e89be9cf50993
BLAKE2b-256 38d84459484d74f1ce881e7481e73f43c395e5c905138021d1a8052a44005597

See more details on using hashes here.

File details

Details for the file seegraph_client-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for seegraph_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b6db88d64d7c5d0db12c98fa9df7c8703d456de1620c0d41b4831d894fabe9b1
MD5 bf7184c5426ef3d1e2a7144c97706240
BLAKE2b-256 d912e468203c133a1d40ce16c5c3749cde168d71a5e2e427e940f438e4e9c495

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