Skip to main content

Cross-framework adapters for Yantrix agent infrastructure — LangChain, CrewAI, AutoGen, MCP

Project description

yantrix-adapters

Cross-framework adapters for Yantrix agent infrastructure.

Add policy enforcement, semantic memory, and full audit traces to any agent framework in 5 lines.

pip install yantrix-adapters

Supported Frameworks

Framework Class Install
LangChain YantrixToolkit pip install yantrix-adapters[langchain]
CrewAI YantrixCrew pip install yantrix-adapters[crewai]
AutoGen YantrixAssistantAgent pip install yantrix-adapters[autogen]
MCP YantrixMCPRouter pip install yantrix-adapters[mcp]
All pip install yantrix-adapters[all]

LangChain

from langchain.tools import DuckDuckGoSearchRun, WikipediaQueryRun
from yantrix_adapters.langchain import YantrixToolkit

# Before: tools = [DuckDuckGoSearchRun(), WikipediaQueryRun()]
# After:
ytx = YantrixToolkit(api_key="ytx_...", agent_id="research_agent")
tools = ytx.wrap([DuckDuckGoSearchRun(), WikipediaQueryRun()])

# Drop into your existing agent — nothing else changes
agent = initialize_agent(tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION)

Observability-only (no tool replacement):

from yantrix_adapters.langchain import YantrixCallbackHandler

handler = YantrixCallbackHandler(api_key="ytx_...")
agent = initialize_agent(tools, llm, callbacks=[handler])

CrewAI

from crewai import Crew, Agent, Task
from yantrix_adapters.crewai import YantrixCrew

researcher = Agent(role="researcher", goal="find information", ...)
writer = Agent(role="writer", goal="write content", ...)
task = Task(description="Research and write about AI trends", ...)

# Before: crew = Crew(agents=[researcher, writer], tasks=[task])
# After:
crew = YantrixCrew.wrap(
    Crew(agents=[researcher, writer], tasks=[task]),
    api_key="ytx_...",
    agent_id="content_crew",
)

result = crew.kickoff()  # Identical call — now governed

AutoGen

from yantrix_adapters.autogen import YantrixAssistantAgent, YantrixUserProxy

# Drop-in replacements for AssistantAgent and UserProxyAgent
assistant = YantrixAssistantAgent(
    "assistant",
    ytx_api_key="ytx_...",
    llm_config={"config_list": config_list},
)

user_proxy = YantrixUserProxy(
    "user_proxy",
    ytx_api_key="ytx_...",
    human_input_mode="NEVER",
    code_execution_config={"work_dir": "coding"},
)

user_proxy.initiate_chat(assistant, message="Research OpenAI pricing trends")

For GroupChat:

from autogen import GroupChat, GroupChatManager
from yantrix_adapters.autogen import YantrixGroupChat

chat = YantrixGroupChat.wrap(
    GroupChat(agents=[agent1, agent2], messages=[], max_round=10),
    api_key="ytx_...",
)
manager = GroupChatManager(groupchat=chat, llm_config=llm_config)

MCP

from mcp.server import Server
from yantrix_adapters.mcp import YantrixMCPRouter

server = Server("my-tools")
router = YantrixMCPRouter(api_key="ytx_...", agent_id="mcp_server")

@server.call_tool()
async def call_tool(name: str, arguments: dict):
    # Route through Yantrix — policy check, memory, trace
    return await router.route(name, arguments, handler=_original_handler)

async def _original_handler(name, arguments):
    # Your existing tool logic here
    ...

FastAPI middleware (wraps entire MCP HTTP server):

from fastapi import FastAPI
from yantrix_adapters.mcp import YantrixMCPMiddleware

app = FastAPI()
app.add_middleware(YantrixMCPMiddleware, api_key="ytx_...", agent_id="mcp_server")

What happens on every call

Your agent action
      ↓
Yantrix Policy Engine  ← is this allowed? within budget?
      ↓ (if allowed)
Yantrix Memory         ← inject relevant past context
      ↓
Original handler       ← your tool/task/agent runs normally
      ↓
Yantrix Trace          ← full audit log stored
      ↓
Result returned

All traces visible at trace.yantrix.ai.


Configuration

ytx = YantrixToolkit(
    api_key="ytx_...",           # or YANTRIX_API_KEY env var
    agent_id="my_agent",         # or YANTRIX_AGENT_ID env var
    budget_usd=5.0,              # optional daily budget cap
    timeout=30,                  # request timeout seconds
    fallback_on_error=True,      # if True: proceed if Yantrix is unreachable
)

fallback_on_error=True (default) means your agents keep working even if Yantrix has an outage. Set to False for strict enforcement.


Links

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

yantrix_adapters-1.0.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

yantrix_adapters-1.0.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file yantrix_adapters-1.0.0.tar.gz.

File metadata

  • Download URL: yantrix_adapters-1.0.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yantrix_adapters-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c02b76f7254d9c9d595636886b777e06a91fcfcc0c70662e404147b6ddd1bfc8
MD5 e1062335a9979661c480b95b4fdedecf
BLAKE2b-256 52b5630bedd7b224a1a3a17190183cd63000314fb926deb3ea1b2dd88944487b

See more details on using hashes here.

Provenance

The following attestation bundles were made for yantrix_adapters-1.0.0.tar.gz:

Publisher: publish.yml on yantrix-ai/yantrix-adapters

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file yantrix_adapters-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for yantrix_adapters-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d503f30a827e987b847cc74c6d314ff2e44f572ac936fa981b9c0b7e924977b
MD5 88ac4605a21c649c52e359b0116792c4
BLAKE2b-256 ced060883a45c35df5407592992d1a83fae22399b8f0450b9001c13d17812c52

See more details on using hashes here.

Provenance

The following attestation bundles were made for yantrix_adapters-1.0.0-py3-none-any.whl:

Publisher: publish.yml on yantrix-ai/yantrix-adapters

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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