Metadata-Version: 2.5
Name: circleflake
Version: 0.1.3
Summary: Agent execution tracing SDK for Circle Flake
Author: Circle Flake
License: MIT License
        
        Copyright (c) 2026 Circle Flake
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
License-File: LICENSE
Requires-Python: >=3.10
Provides-Extra: deepagents
Requires-Dist: deepagents; extra == 'deepagents'
Requires-Dist: langchain-core>=0.3; extra == 'deepagents'
Requires-Dist: langgraph; extra == 'deepagents'
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Provides-Extra: langchain
Requires-Dist: langchain>=1.0; extra == 'langchain'
Provides-Extra: langgraph
Requires-Dist: langchain-core>=0.3; extra == 'langgraph'
Requires-Dist: langgraph>=0.2; extra == 'langgraph'
Description-Content-Type: text/markdown

# Circle Flake Python SDK

Capture agent execution from LangChain, LangGraph, and Deep Agents using one
framework-independent trace/span model.

## Install

```bash
pip install -e ".[langchain,dev]"
```

Install `.[langgraph]` or `.[deepagents]` when using those frameworks.

## LangChain

Run the included deterministic sample (no provider API key required):

```bash
python examples/langchain_agent.py
```


```python
from circleflake import CircleFlake

cf = CircleFlake(agent_name="gtm-agent")

# Pass the handler to a chain/model invoke call.
result = chain.invoke(
    {"input": "Qualify Acme"},
    config={"callbacks": [cf.langchain_handler]},
)

# Export captured traces as JSON.
print(cf.exporter.exported)

# Optional: POST completed traces to your Circle Flake ingestion endpoint.
# cf = CircleFlake(agent_name="gtm-agent",
#                  endpoint="https://api.example.com/v1/traces",
#                  api_key="...")
cf.flush()
```

## LangGraph

LangGraph accepts LangChain callback handlers through RunnableConfig:

```python
result = graph.invoke(
    {"messages": [...]},
    config={"callbacks": [cf.langgraph_handler]},
)
```

The LangGraph adapter uses the callback lifecycle and records graph/node metadata
when supplied by the runtime.

## Deep Agents

Deep Agents are built on the LangGraph/LangChain runtime. Start by passing the
Deep Agents adapter in the same callbacks config:

```python
result = agent.invoke(
    {"messages": [...]},
    config={"callbacks": [cf.deepagents_handler]},
)
```

This captures framework callback activity. Deep-Agent-specific planning and
delegation semantics are not yet normalized into dedicated span types; those
will be added against the exact Deep Agents version used by your application.

## Data handling

Inputs and outputs are not captured by default. Set `capture_content=True` only
if you have reviewed the privacy implications for your prompts, tool arguments,
and outputs.
