VisvoAI Docs
visvoai-core

visvoai-core

The agent-tools loop on LangGraph, with a soft step cap, tool retrieval, and pluggable persistence

visvoai-core is the agent↔tools loop — the LangGraph app every "agent" product needs, built once and subclassed instead of forked. It takes any LangChain BaseChatModel (whether or not it came from visvoai-ai) plus a list of tools in whatever shape you already have them, and returns a compiled, streamable LangGraph graph:

from visvoai.core.runtime import AgentRuntime
from visvoai.core import ask

graph = AgentRuntime().build_graph(
    model=model,
    core_tools=[read_file, search_notes],
    system_prompt="You are a concise code assistant.",
)
answer = await ask(graph, "What's in pyproject.toml?")

This is examples/07_everything_together.py — a real ops-assistant turn, tool retrieval, and a checkpointer-backed follow-up ("restart it"), running with no API key (a scripted model, same graph, same code path):

The problem this solves

LangGraph's create_react_agent prebuilt covers the demo. The moment a real product needs a step budget the model can't argue past — instead of a GraphRecursionError surfacing to a user — or hundreds of tools from a handful of MCP servers without wrecking tool-choice accuracy, or a tool call audit trail, every team re-derives the same ~150 lines of LangGraph plumbing, slightly differently, slightly wrong. visvoai-core is that plumbing, tested by two shipping consumers: a full terminal coding agent (visvoai-cli) and a hosted multi-tenant platform that subclasses the exact seams documented here — no forks.

What's in this section

  • The agent loopAgentRuntime, build_graph, the soft step cap that replaces GraphRecursionError with one clean final answer.
  • Defining tools — the four tool shapes build_graph accepts in the same list: plain functions, Args: documented functions, async functions, and the BaseAgentTool lifecycle class.
  • Extension seams — all eight AgentRuntime hooks, each with a working code example: extra graph nodes, a custom agent/tools node, custom routing, checkpointers, state, and interrupt points.
  • PersistenceToolPersistence / LLMPersistence, the lifecycle hooks that let every tool call and LLM call land in your datastore with zero call-site wrapping.
  • Tool retrieval at scaleToolCatalog, BM25/hybrid semantic retrieval, and per_round_retrieve for binding 8 relevant tools out of 300 instead of all 300.
  • Subagents — an agent calling another agent is a ~25-line helper, not a special API.

No hidden framework

There is no visvoai-core-specific DSL to learn. The compiled graph is a standard LangGraph StateGraphastream_events(version="v2") gives you every model token and tool call exactly as any LangGraph app would. Tools are plain Python functions unless you opt into the lifecycle class. If you outgrow every seam here, you have a LangGraph app you can keep extending directly — nothing to migrate off.

pip install visvoai-core   # pulls only langgraph + langchain-core

See it running as a full product, not a snippet, at cli.visvoai.com — the same AgentRuntime, unmodified, under a terminal UI with OS-enforced sandboxing.

On this page