Metadata-Version: 2.4
Name: codini
Version: 0.2.0
Summary: Official Python SDK for the Codini AI API
License: ISC
Project-URL: Homepage, https://codini.ai
Project-URL: Repository, https://github.com/codini/codini-python
Project-URL: Documentation, https://www.npmjs.com/package/codini
Keywords: codini,ai,sdk,api,flows,agents
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# codini

Official Python SDK for the [Codini AI](https://codini.ai) API.

Build, manage, and execute AI flows programmatically. Zero dependencies.

## Install

```bash
pip install codini
```

## Quick Start

```python
from codini import CodiniClient

codini = CodiniClient("your-api-key")

# Execute a flow
result = codini.sync_execute(1, input="Hello")
print(result["data"]["output"])

# Build a flow programmatically
project = codini.projects.create("My App")
flow = codini.flows.create("Chat Agent", project["data"]["id"])

nodes = codini.flows.add_nodes(flow["data"]["id"], [
    {"type": "onMessageTrigger", "position": {"x": 0, "y": 200}},
    {"type": "create-agent", "position": {"x": 300, "y": 200}, "params": {
        "name": "Assistant", "model": "gpt-4o", "type": "auto",
        "role description": "Helpful assistant"
    }},
    {"type": "replyToChat", "position": {"x": 600, "y": 200}},
])

trigger, agent, reply = nodes["data"]["nodes"]
codini.flows.add_edges(flow["data"]["id"], [
    {"source": trigger["id"], "target": agent["id"]},
    {"source": agent["id"], "target": reply["id"]},
])
```

## API

### Execution

```python
codini.create_ticket(flow_id=1, use_websocket=True)
codini.sync_execute(flow_id, input="Hello", variables={"lang": "en"})
codini.async_execute(flow_id, input="Hello")
codini.get_run_status(run_id)
codini.poll_run_status(run_id, interval=2.0, max_attempts=150)
```

### Projects

```python
codini.projects.list()
codini.projects.create("My App", description="Optional")
codini.projects.get(project_id)
codini.projects.update(project_id, name="New Name")
codini.projects.delete(project_id)
```

### Flows

```python
codini.flows.list()                    # All flows
codini.flows.list(project_id=38)       # Flows in a project
codini.flows.get(flow_id)
codini.flows.create("My Flow", project_id=38)
codini.flows.update_details(flow_id, name="New Name")
codini.flows.delete(flow_id)

# Programmatic building
codini.flows.add_nodes(flow_id, [{...}])
codini.flows.add_edges(flow_id, [{...}])
codini.flows.build(flow_id, nodes, edges)

# Node catalog
codini.flows.list_node_types()
codini.flows.get_node_definitions(["create-agent", "chat-memory"])

# Full canvas save
codini.flows.save(flow_id, nodes=[...], edges=[...])
```

### Secrets

```python
codini.secrets.list()
codini.secrets.create("my_key", "my_value")
codini.secrets.get("my_key")
codini.secrets.delete("my_key")
```

## Zero Dependencies

Uses only Python standard library (`urllib`, `json`). No `requests` needed.

## Requirements

Python 3.8+

## License

ISC
