AgentKit Knowledge Quickstart Guide
AgentKit Knowledge provides one-click configuration and import capabilities for mainstream knowledge bases, enabling easy association with knowledge bases on the AgentKit platform. It offers unified knowledge base interfaces and framework integration, enhancing the convenience of using different knowledge bases for Agents.
Usage Example
The steps are as follows:
- Create a knowledge base resource
- Add template files to the knowledge base
- Retrieve records from the knowledge base
Creating a Knowledge Base
Through the Volcano Engine Console, create a knowledge base for your agent using VikingDB-Knowledge, and add the following content as qa.md to the customer_support knowledge base.
# Intelligent Customer Service Knowledge Base
## 1. Company Introduction
VE Technology is a high-tech company specializing in intelligent customer service and knowledge management. Our core product is the **Intelligent Customer Service System**, which provides efficient and intelligent automated customer service solutions for enterprise clients through natural language processing and knowledge base retrieval.
## 2. Product Features
- **Automatic Q&A**: Quickly respond to common questions based on the knowledge base.
- **Multi-channel Access**: Support for web, App, WeChat, Feishu, and other channels.
- **Intelligent Recommendations**: Recommend relevant answers based on context.
- **Data Analytics**: Provide user question statistics and customer service performance reports.
- **Self-service Knowledge Base Management**: Support for non-technical personnel to quickly edit knowledge content.
---
## 3. Frequently Asked Questions (FAQ)
### Q1: What languages does the Intelligent Customer Service System support?
A1: Currently supports **Chinese** and **English**, with Japanese, Korean, and other multi-language support to be added gradually.
### Q2: Can the system integrate with existing CRMs?
A2: Yes. Our system supports seamless integration with mainstream CRM systems (such as Salesforce, Zoho, Kingdee) through APIs.
### Q3: What happens if the bot cannot answer a user's question?
A3: The system will automatically transfer the question to a human customer service agent and record the question in the backend for administrators to add to the knowledge base.
### Q4: How often is the knowledge base content updated?
A4: The knowledge base supports **real-time updates**, taking effect immediately after administrators submit changes.
## 4. Contact Us
- Website: [https://www.example.com](https://www.example.com)
- Support Email: support@volcengine.com
- Service Hotline: 400-123-4567Importing the Knowledge Base
Through the Volcano Engine Console, import the knowledge base for your agent using Agentkit-Knowledge
Obtaining Connection Information for Memory Resources
On the memory details - integration code page, obtain the connection information.
- For VikingDB Knowledge type memory resources, you will see environment variables similar to the following:
export DATABASE_VIKING_COLLECTION=customer_support
export DATABASE_VIKING_PROJECT=default
export DATABASE_VIKING_REGION=cn-beijingBuilding an Agent with Knowledge Base Capabilities
VeADK is an open-source agent development framework that provides development, runtime, and debugging capabilities for agents, maintained by the Volcano Engine team.
The following example demonstrates how to use VeADK to build an agent with knowledge base capabilities, using VikingDB Knowledge as the knowledge base backend. The agent can answer user questions based on the knowledge base according to user input.
You don't need to build a veadk project from scratch. It is recommended to use agentkit-cli to create a project from the Basic Agent App template (the template uses the VeADK framework). After the template is created, you need to make the following modifications:
- Add
Knowledgebaseto the Agent - Configure the environment variables obtained in the previous section to
agentkit.yaml
Finally, your code file should look like this:
'''
**simple agent demo app**
Before running, the user must set the following environment variables; otherwise, runtime exceptions will inevitably occur:
- MODEL_AGENT_NAME # model id in Volcano Engine Ark platform
- MODEL_AGENT_API_KEY # model api key in Volcano Engine Ark platform
MODEL_AGENT_NAME and MODEL_AGENT_API_KEY are used to access the model service of the Volcano Engine Ark platform.
'''
import logging
import os
from veadk import Agent, Runner
from veadk.knowledgebase import KnowledgeBase
from agentkit.apps import AgentkitSimpleApp
logger = logging.getLogger(__name__)
collection_name = os.getenv("DATABASE_VIKING_COLLECTION")
if not collection_name:
raise ValueError("DATABASE_VIKING_COLLECTION environment variable is not set")
model_name = "doubao-seed-1-6-250615"
app = AgentkitSimpleApp()
knowledgebase = KnowledgeBase(backend="viking", index=collection_name)
agent = Agent(
instruction="Answer customer's questions according to your knowledgebase.",
model_name=model_name,
knowledgebase=knowledgebase
)
runner = Runner(agent=agent)
@app.entrypoint
async def run(payload: dict, headers: dict) -> str:
prompt = payload["prompt"]
user_id = headers["user_id"]
session_id = headers["session_id"]
logger.info(
f"Running agent with prompt: {prompt}, user_id: {user_id}, session_id: {session_id}"
)
response = await runner.run(messages=prompt, user_id=user_id, session_id=session_id)
logger.info(f"Run response: {response}")
return response
@app.ping
def ping() -> str:
return "pong!"
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000)Environment Configuration
Please add the following configuration to your agentkit.yaml file:
launch_types:
cloud:
runtime_envs:
DATABASE_VIKING_COLLECTION: <your viking collection name>Starting the Service
Run agentkit launch. The built Runtime connection information will be automatically saved in the agentkit.yaml file.
How to Initiate a Call
Execute the following to initiate a call:
agentkit invoke "What products do you have?"You will see the Agent successfully retrieve information from the knowledge base and reorganize the language from qa.md to answer you.
