Metadata-Version: 2.5
Name: arvex.ai
Version: 0.2.0
Summary: A Python foundation for project-local AI agents
Requires-Python: >=3.11
Requires-Dist: filelock<5,>=3.16
Requires-Dist: pyjwt[crypto]<3,>=2.10.1
Description-Content-Type: text/markdown

# arvex.ai

Arvex is a Python foundation for agents that live in your project.
It requires Python 3.11 or later. [Feature history](VERSIONS.md)

## Install with uv

From the checkout, install the package and run the demos.

```sh
uv sync
uv run python demo/1_chat.py
uv run python demo/2_setup.py
uv run python demo/3_create_agent.py
```

`uv build` creates a source distribution and wheel in `dist/`. The version
comes from the latest version tag reachable from the checked-out commit. Tags
such as `0.1.1` and `v0.1.1` both produce version `0.1.1`. Later commits and
local edits use that same version until a new tag is reachable. A checkout
needs a version tag to build. The source distribution carries its resolved
version so it can be built without Git.

Install the resulting wheel into a virtual environment with
`uv pip install PATH_TO_WHEEL`, using the path printed by `uv build`.

## Chat from Python

```python
from arvex.ai import create_agent, load_agent, setup

setup()
agent = create_agent("aras", instructions="Be concise.")
print(agent.chat("Hello, Aras.", demo=True))

# In a later process in the same directory
agent = load_agent("aras")
print(agent.history())
```

Pass a directory to `setup()` to use a custom location for shared settings.
Pass `api_key=` to record an OpenAI credential from Python.

## Chat from the terminal

Run agent commands from the project directory containing `.aras/`. Name the
agent in each command so it applies to the intended directory.

```sh
uv run arvex setup
uv run arvex create-agent aras --instructions "Be concise."
uv run arvex start aras --demo
```

`arvex start` uses the agent's active channel, which defaults to the terminal.
Use `/exit` to leave interactive chat. To use the terminal directly for any
agent, run `arvex chat aras` or send one message with `arvex chat aras -m "Hello"`.

## Chat from Telegram

Create a bot with BotFather, then run setup from the agent's project
directory. Arvex asks for the bot token in a hidden prompt and verifies the bot.
[Telegram bot setup](https://core.telegram.org/bots/tutorial)

```sh
uv run arvex channel add telegram --agent aras
```

While setup is waiting, send the printed `/pair CODE` to the bot in a private
chat within ten minutes. Setup finishes and makes Telegram active once the bot
receives the code. Then start the agent and send a message in Telegram.

```sh
uv run arvex start aras
```

Telegram uses the same agent and chat history as the terminal. Keep the start
command running to receive messages and press Ctrl+C to stop. Repeat
`arvex channel add telegram --agent aras` to pair again. Set `active_channel`
to `"terminal"` in `.aras/agent.json` to make `arvex start aras` use the
terminal again.

Pass `--bot-id ID` to verify an expected numeric bot ID, or let Arvex read it
from Telegram. The channel settings, including the bot ID and pairing, are recorded under
`channels.telegram` in `.aras/agent.json`. The token is saved separately in the
agent's shared configuration directory. For scripts, supply the token through
`ARVEX_TELEGRAM_BOT_TOKEN`.

Run `arvex start aras --demo` to test Telegram without using a model provider.
The [offline channel demo](demo/5_telegram.py) simulates Telegram and verifies
setup, pairing, removal, and shared history. If a delivery is interrupted, resend the
message to request another reply.

To remove Telegram, stop the worker with Ctrl+C and run the following command.

```sh
uv run arvex channel rm telegram --agent aras
```

This clears the agent's Telegram pairing and returns an active Telegram
channel to the terminal. The agent keeps its chat history, and the shared bot
token remains available to other agents.

## Connect your ChatGPT account

```sh
uv run arvex setup --chatgpt
uv run arvex chat aras -m "Hello"
```

Complete the browser sign-in and approve use of your ChatGPT plan. Eligible
requests use that plan. Arvex picks an available model for the connected
account. Use `arvex setup --chatgpt --model MODEL` to choose another available
model or `arvex setup --chatgpt work` to connect under a separate account label.
Existing agents use the selected account and its model the next time you chat.
[OpenAI sign-in and plan usage](https://developers.openai.com/siwc/token-sharing-open-source)

In Python, use `setup(chatgpt=True)`. The
[live sign-in demo](demo/4_chatgpt.py) opens the browser and sends one request
using the connected plan.

To use API-key billing, set `OPENAI_API_KEY` and run
`uv run arvex setup --use-api-key`, or record a key with
`uv run arvex setup --prompt-key`. Agents use their own configured model in
API-key mode. The default for newly created agents is `gpt-4.1-mini`.
