Skip to main content

Python SDK for Panofy Agent Platform

Project description

Panofy Python SDK

Python SDK for the Panofy Agent Platform.

Installation

pip install panofy

Quick Start

from panofy import Panofy

panofy = Panofy(
    agent_id="your-agent-id",
    api_key="da_your_api_key",
)

result = panofy.predict(input="hello")
print(result)

# Inspect token usage and point cost from the last predict run.
print(panofy.last_usage())       # cache_read, cache_write, output_token
print(panofy.last_point_usage()) # points_consumed

# Pass multiple Agent input fields directly as keyword arguments.
summary = panofy.predict(
    title="AI 入门",
    language="zh-CN",
    max_length=200,
)

# String values that point to existing local files are uploaded automatically
# and rewritten to task-visible filenames in FUNC_INPUT.json.
report = panofy.predict(
    claim_application_file="./Claims_application-C2104.json",
)

# Disable output-side file downloads while still returning parsed FUNC_OUTPUT.json.
raw_report = panofy.predict(
    claim_application_file="./Claims_application-C2104.json",
    output_dir=None,
)

# Bound the wait time and best-effort abort the task server-side on timeout.
bounded = panofy.predict(
    input="hello",
    timeout=600.0,
)

predict() uploads FUNC_INPUT.json, starts the BFF plan→execute pipeline via /api/sdk/predict-async, polls /api/sdk/runs/{run_id} until the SDK run reaches a terminal status, then downloads and returns parsed FUNC_OUTPUT.json. After a terminal run, panofy.last_usage() returns the latest token usage as cache_read, cache_write, and output_token when returned by the API; panofy.last_point_usage() returns points_consumed. Use predict_with_metadata(...) when you want the parsed output and run metadata (run_id, task_id, points, and usage) in one return value.

result = panofy.predict_with_metadata(input="hello")
print(result.output)
print(result.run.run_id, result.run.points_consumed, result.run.usage)

The client defaults to https://panofy.ai. Pass base_url="http://localhost:3000" only for local development or a custom/private deployment.

If an Agent input field name conflicts with SDK controls such as timeout, output_dir, resolve_files, or files, pass one complete dict instead: panofy.predict({"timeout": 30, "input": "hello"}).

One-shot training

from panofy import train

result = await train(
    api_key="da_your_api_key",
    name="sales analyst",
    model_id="PANOFY_AIR",
    instruction="You are a sales data analyst.",
    training_data=[
        "./training/function_definition.md",
        "./training/FUNC_INPUT.json",
        "./training/FUNC_OUTPUT.json",
    ],
)

print(result.agent_id, result.task_id)

License

MIT

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

panofy-0.6.0.tar.gz (40.0 kB view details)

Uploaded Source

Built Distribution

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

panofy-0.6.0-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file panofy-0.6.0.tar.gz.

File metadata

  • Download URL: panofy-0.6.0.tar.gz
  • Upload date:
  • Size: 40.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for panofy-0.6.0.tar.gz
Algorithm Hash digest
SHA256 bfafa410ec53535b7619d410938e4e7a750836f5bb9143b5ec6f41fb723312f0
MD5 6b3292410556705891e1ea3eadf14afe
BLAKE2b-256 dd50b880605ebe3a6334ebd5aacd4d9a37790e4ecacb64696d28df4f3ae1fcc7

See more details on using hashes here.

Provenance

The following attestation bundles were made for panofy-0.6.0.tar.gz:

Publisher: publish.yml on Prism-Shadow/panofy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file panofy-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: panofy-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for panofy-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42995095663526442a8f996eb7f9ce517c53b3645e1af25633ddfee7e047c79d
MD5 fdf5bde16bdecaf256cc846798cd3c3e
BLAKE2b-256 b9f9fd5c58ebdda0bf2718a81e86388ce745b53586dc7319e49aaaa70eea264f

See more details on using hashes here.

Provenance

The following attestation bundles were made for panofy-0.6.0-py3-none-any.whl:

Publisher: publish.yml on Prism-Shadow/panofy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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