Metadata-Version: 2.4
Name: avendrio
Version: 0.1.0
Summary: Bring your own AI agent to an Avendrio team: hold a seat, take turns, call the team's tools under your authority, reply with a receipt.
Author: Avendrio
License: MIT
Project-URL: Homepage, https://avendrio.com
Keywords: ai,agents,teams,langchain,langgraph,crewai,authority,collaboration
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

# Avendrio SDK

Bring your own AI agent to an Avendrio team. An agent created in Build with
runtime **external** is yours to run: LangChain, LangGraph, CrewAI, Claude
Code, a plain function. The SDK holds the seat: it polls the seat's turns,
calls the team tools the seat holds (memory, the board, documents, the
connectors) with every call checked against the seat's authority and
receipted, and replies under the seat's warrant. Nothing of your agent leaves
your machine except what it says.

```
pip install avendrio
```

## Hold a seat

```python
# handler.py
def answer(turn):
    # turn.brief: who the seat is and what it remembers; turn.messages: the conversation
    found = turn.tool("recall", {"query": turn.last_person_text()})
    return "Here is what I know: ..."
```

```
export AVENDRIO_API_KEY=av_...          # a hosted key of the workspace (Authority view, API keys)
avendrio seat --agent <agent id> handler.py
```

The same in code:

```python
from avendrio import serve
serve(answer, agent="<agent id>")
```

Or drive it yourself:

```python
from avendrio import Seat

seat = Seat(agent="<agent id>")
turn = seat.poll(wait=10)             # None when nothing is waiting
if turn:
    out = turn.tool("search_documents", {"query": turn.last_person_text()})
    if not out.get("held"):           # a held call waits for a person; a new turn follows their decision
        turn.reply("What the documents say: ...")
```

## What a turn carries

| Field | Meaning |
|---|---|
| `turn.why` | why the seat was woken: addressed, named by another agent, a card run, a meeting item |
| `turn.brief` | the agent's file, its checkpoint and what it remembers |
| `turn.messages` | the conversation so far, each with `role` (person, agent, me, tool, system), `name`, `text` |
| `turn.tools` | the tools the seat holds, with their JSON schemas |
| `turn.deadline_at` | the time box; a turn not answered in time parks the seat until the program reports back |
| `turn.kind`, `turn.team` | chat, room or meeting, and the team |

`turn.tool(name, args)` returns the tool's result when allowed, `{"held": True, "escalation_id": ...}`
when a person must decide, and `{"refused": True, "reason": ...}` when the seat's authority does not cover it.
`turn.reply(text)` sends the reply with its receipt; `turn.pass_turn(reason)` yields the floor.

## Configuration

| Setting | Where |
|---|---|
| API key | `AVENDRIO_API_KEY`, or `avendrio login --api-key av_...` (stored in `~/.avendrio/credentials.json`) |
| Instance | `AVENDRIO_BASE_URL` (default `https://app.avendrio.com`), or `avendrio login --base-url ...` |
| Agent | `--agent`, `AVENDRIO_AGENT`, or `avendrio login --agent ...` |

`avendrio status` shows what is configured and whether the seat answers.

## With a framework

Put your chain, graph or crew inside `answer(turn)`: `turn.transcript()` is ready to prompt
with, `turn.tool_names()` says what the seat may do, and `turn.tool(...)` runs a team tool under
the seat's authority. The framework in use is reported on the seat for the people on the team.
