Skip to main content

PathFlow Python Telemetry SDK

pathflow is a zero-config, lightweight AI Agent Telemetry and Profiling SDK for PathFlow.

It automatically captures execution traces, DAG parent/child span trees, duration timing, model details, token counts, cost attribution, and exceptions for AI agents—with zero friction and zero changes to your core agent logic.


🚀 Installation

pip install pathflow

⚙️ Configuration

Set your credentials via environment variables:

export PATHFLOW_API_KEY="pf_live_..."

# Optional (only if self-hosting or using custom endpoint)
export PATHFLOW_ENDPOINT="https://pathflow-psi.vercel.app/api/v1"

Or pass them explicitly into the constructor:

from pathflow import PathFlow

pf = PathFlow(
    api_key="pf_live_...",
    endpoint="https://pathflow-psi.vercel.app/api/v1"
)

⚡ Basic Usage: Function Decorator

Wrap your main agent function with @pf.trace():

from pathflow import PathFlow

pf = PathFlow()

@pf.trace(
    name="Customer Support Resolution Agent",
    project="backend-service",
    environment="production"
)
def run_agent(user_query: str):
    # Your agent code here
    return "Issue resolved"

if __name__ == "__main__":
    run_agent("How do I reset my password?")

Note: Telemetry dispatching runs safely in the background. Telemetry errors will never interrupt or crash your agent application logic.


🔍 Granular Spans & Context Management

Create granular parent/child spans around LLM completions, database queries, and tool executions using with pf.span(...):

from pathflow import PathFlow

pf = PathFlow()

@pf.trace(name="Deep Research Agent", project="analytics")
def research_agent(topic: str):
    # 1. Search Tool Span
    with pf.span(name="Web Search", type="Tool") as span:
        span.set_input({"query": topic})
        results = ["Doc 1", "Doc 2"]
        span.set_output({"docs_found": len(results)})

    # 2. LLM Completion Span
    with pf.span(name="Groq Llama 3.3 LLM", type="LLMCall") as span:
        span.set_input({"prompt": topic})
        span.set_model("llama-3.3-70b-versatile")
        
        # Attach exact tokens and cost if available
        span.set_tokens(input_tokens=1400, output_tokens=350)
        span.set_cost(0.0028)
        
        response = "Synthesized analysis..."
        span.set_output({"response": response})

    return response

🔒 Secret Sanitization

PathFlow automatically redacts sensitive patterns (such as API keys sk-, gsk_, pf_live_, Bearer , passwords, and authorization tokens) from stringified raw inputs and outputs before transmission.


📜 License

MIT License. See LICENSE for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pathflow-0.1.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

pathflow-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pathflow-0.1.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pathflow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 45d72e0824a1fceade2c530a264b0ba8d0feb33bf5ca040fbd43916de44ce444
MD5 111bb85a946fc25ee97dd1a4e2a12392
BLAKE2b-256 2e754a0e9df367e86b105ee265d2833a3355e174c5f2f000bdded7bfcf0e6daa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pathflow-0.1.0.tar.gz:

Publisher: publish.yml on anothercodingguy/pathflow

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

File details

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

File metadata

  • Download URL: pathflow-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pathflow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 134ae05d4555ae45d327a2bf3d9972aab99dcffa2cff879b1b1f2ca94ae0c4e1
MD5 9045a6cc16ede22f82c6747bdea915be
BLAKE2b-256 131cd1dfcb7153074321824b7b48ad91bf4a60f73a91cee866db0f760b66ea8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pathflow-0.1.0-py3-none-any.whl:

Publisher: publish.yml on anothercodingguy/pathflow

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