Skip to main content

Agent economics SDK — track ROI, KPIs, and cost for AI agents in 2 lines of code

Project description

VelenAI SDK

Agent economics in 2 lines of code. Track ROI, KPIs, and cost for your AI agents.

Langfuse is the debugger. VelenAI is the CFO.

Install

pip install velenai

With framework adapters:

pip install velenai[crewai]    # CrewAI adapter
pip install velenai[langgraph]  # LangGraph adapter
pip install velenai[autogen]    # AutoGen adapter

Quick Start

from velenai_sdk import VelenAI

vai = VelenAI(api_key="your-key", api_secret="your-secret", host="http://localhost:8000")

Decorator (simplest)

@vai.track("my-agent")
def run_agent(query: str):
    result = llm.chat(query)
    return result

# Async works too
@vai.track("my-async-agent")
async def run_agent(query: str):
    return await llm.chat(query)

Context Manager (more control)

with vai.trace("my-agent") as t:
    result = do_work()
    t.success = True
    t.tokens = 150
    t.cost_usd = 0.003
    t.metadata["model"] = "gpt-4"

Manual

vai.emit(
    agent_id="my-agent",
    success=True,
    latency_ms=1200,
    tokens=150,
    cost_usd=0.003,
    metadata={"model": "gpt-4"},
)

Framework Adapters

CrewAI

from velenai_sdk import VelenAI
from velenai_sdk.adapters.crewai import VelenAICrewCallback

vai = VelenAI()
crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, write_task],
    callbacks=[VelenAICrewCallback(vai)]
)

LangGraph

from velenai_sdk import VelenAI
from velenai_sdk.adapters.langgraph import instrument_graph

vai = VelenAI()
graph = StateGraph(...).compile()
graph = instrument_graph(vai, graph, agent_id="my-workflow")
result = graph.invoke(input)

Or as a LangChain callback:

from velenai_sdk.adapters.langgraph import VelenAILangGraphCallback

result = graph.invoke(input, config={"callbacks": [VelenAILangGraphCallback(vai)]})

AutoGen

from velenai_sdk import VelenAI
from velenai_sdk.adapters.autogen import instrument_agent

vai = VelenAI()
assistant = AssistantAgent("analyst", llm_config=llm_config)
assistant = instrument_agent(vai, assistant)

Environment Variables

Instead of passing keys to the constructor:

export VELENAI_API_KEY=your-key
export VELENAI_API_SECRET=your-secret
export VELENAI_HOST=http://localhost:8000
vai = VelenAI()  # picks up from env

Features

  • Sync and async support
  • Background batching (events queued and flushed every 5s)
  • HMAC-signed requests (replay-protected)
  • Fire-and-forget (never blocks your agent)
  • Framework adapters: CrewAI, LangGraph, AutoGen
  • Zero dependencies beyond httpx
  • Self-hosted and open source

License

MIT

Project details


Download files

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

Source Distribution

velenai-0.1.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

velenai-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: velenai-0.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for velenai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6cdb07d21ba3adf80a7ef43247eedecef77d4ea2320ae1016a11868595ce55d8
MD5 cb7829b92e0d64f1ad43e82b8d1a0872
BLAKE2b-256 52efde3686c17ce7d4f3fbae0c2115cc9f29d8d99cd12a7783cb6a4cb6d5c330

See more details on using hashes here.

File details

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

File metadata

  • Download URL: velenai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for velenai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8075513c970e74e0ce54925d1e406378644ba765e56ddd30e4a330f34fed2879
MD5 02f0c0db6361145137dfd7373d7c97c7
BLAKE2b-256 b17ed204dc6e6794c4b67f93b76c66ab8481bc2315a791ae5b13da5eeaddbf05

See more details on using hashes here.

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