py-vectara-agentic is a Python library for building AI assistants and agents, with its core being the combination of Vectara and Agentic RAG. It is based on the LlamaIndex Agent framework and provides helper functions to help developers quickly create tools connected to Vectara corpora.
Main capabilities:
- Rapid tool creation: Build Vectara RAG tools or search tools with one line of code.
- Agent flexibility: Supports multiple agent types such as ReAct and Function Calling.
- Preset domain tools: Provides tools for vertical domains such as finance and law.
- Multi-LLM integration: Can connect to OpenAI, Anthropic, Gemini, GROQ, Together.AI, Cohere, and Bedrock.
- Observability: Built-in Arize Phoenix support for monitoring and feedback.
- Workflow support: Custom workflows can be defined through the run() method to extend agent capabilities.
Usage (based on official documentation examples):
- Initialize the Vectara tool factory.
- Create a Vectara RAG tool: The RAG tool calls the full Vectara RAG pipeline to generate grounded, summary-style answers based on the data. Additional parameters (such as year, ticker) can be defined and mapped to the corpus's filter attributes; the query parameter is automatically added by create_rag_tool.
- Optionally create other tools: such as math tools, tools that call other APIs, etc.
- Create an agent: Define custom instructions and instantiate the Agent class; the topic parameter identifies the agent's area of expertise, custom_instructions customizes behavior and how information is presented; agent_progress_callback is optional and is used to track events such as tool calls in real time.
- Run chat interactions: Supports standard synchronous chat (chat()), asynchronous chat (achat()), and streaming chat (stream_chat(), astream_chat()). chat() and achat() return an AgentResponse object, and the text can be obtained with .response or str(); the streaming methods return an AgentStreamingResponse object, providing realTime-based chunking and final response.
On the tools side:
- Provides two helper functions, create_rag_tool() and create_search_tool(), used respectively to query a Vectara corpus and return a list of matching documents.
- The RAG tool supports metadata filtering: parameters can carry conditions (such as year='>2022'), supports fixed_filter for fixed filter conditions, and tool_args_type can optionally be a dictionary used to specify the filter level (doc or part), whether it is a list, the filter name, and so on.
- Built-in standard tools: summarize_text, rephrase_text.
- Legal tools: summarize_legal_text, critique_as_judge.
- Financial tools: based on Yahoo! Finance, including balance_sheet, income_statement, cash_flow, stock_news, stock_analyst_recommendations.
- Database tools: list_tables, describe_tables, load_data, load_sample_data, load_unique_values.
- Other integrations (from LlamaIndex ToolSpecs): Tavily Search, EXA.AI, Brave Search search tools; arXiv academic tools; Neo4j, Kuzu, Waii database tools; Gmail, Google Calendar, Google Search Google tools; Slack communication tools.
- Custom tools can also be created from Python functions via the ToolsFactory create_tool() method.
Prerequisites:
- A Vectara account.
- A Vectara corpus with an API key.
- Python 3.10 or higher.
- An OpenAI API key (or an API key for the chosen Anthropic, TOGETHER.AI, Cohere, GEMINI, GROQ).
- If using AWS Bedrock: the required Bedrock models must be enabled in the account, the environment must contain AWS_PROFILE, and AWS_REGION must be set to the target region (default us-east-2).
Limitations:
- The specific pricing, charges, platform compatibility, and other effects or steps not mentioned above are not yet provided in the material.