Where to Find the Knowledge Service OpenAPI Specification in TencentDB-Agent-Memory

The Knowledge service OpenAPI specification is located at MemoryKnowledge/openapi.yaml in the root of the TencentDB-Agent-Memory repository and implements the OpenAPI 3.0.3 standard.

The TencentDB-Agent-Memory repository provides a microservice architecture for database agent memory management. The Knowledge service exposes its API contract through a canonical OpenAPI specification that enables automated client generation and interactive documentation. This guide identifies the exact file location and implementation patterns used throughout the codebase.

Canonical Location of the Knowledge Service OpenAPI Spec

The primary OpenAPI definition resides in the MemoryKnowledge directory at the repository root. The file openapi.yaml contains the complete OpenAPI 3.0.3 specification used by the Knowledge microservice, including endpoint definitions, request schemas, and response models.

According to the TencentDB-Agent-Memory source code, this path represents the single source of truth for the Knowledge API contract. The project README.md explicitly references this location in the Knowledge OpenAPI section, confirming its role as the authoritative documentation source.

Implementation Details and File References

Server-Side Specification Loading

In MemoryKnowledge/src/server.ts, the Knowledge service implements the runtime loading of the OpenAPI specification. The server reads openapi.yaml from the filesystem to serve interactive Swagger UI documentation and JSON schema endpoints.

Container Packaging

Production deployments package the specification via deploy/panel-knowledge-combined/Dockerfile. This Dockerfile copies MemoryKnowledge/openapi.yaml into the container image to ensure the API contract is available at runtime for service discovery and documentation serving.

Practical Usage Examples

Developers can leverage the Knowledge service OpenAPI specification for client generation, documentation hosting, and contract validation.

Serving Swagger UI with Node.js

To load the specification using a Swagger UI client in an Express application:

import swaggerUi from 'swagger-ui-express';
import express from 'express';
import path from 'path';
import fs from 'fs';

const app = express();
const specPath = path.resolve(__dirname, '..', 'MemoryKnowledge', 'openapi.yaml');
const spec = fs.readFileSync(specPath, 'utf8');

app.use('/docs', swaggerUi.serve, swaggerUi.setup(JSON.parse(spec)));
app.listen(3000, () => console.log('Swagger UI available at http://localhost:3000/docs'));

Downloading the Raw Specification

Fetch the OpenAPI YAML directly via HTTP using cURL:

curl -s https://raw.githubusercontent.com/TencentCloud/TencentDB-Agent-Memory/feat/server_team/MemoryKnowledge/openapi.yaml \
  -o knowledge-openapi.yaml

Generating Typed Clients

Use OpenAPI Generator to create type-safe clients from the specification:

openapi-generator-cli generate \
  -i https://raw.githubusercontent.com/TencentCloud/TencentDB-Agent-Memory/feat/server_team/MemoryKnowledge/openapi.yaml \
  -g java \
  -o ./generated-client

Docker Integration

Include the specification in your container image for runtime access:


# Copy the spec into the container for Swagger UI

COPY MemoryKnowledge/openapi.yaml /app/knowledge/openapi.yaml

Summary

  • The Knowledge service OpenAPI specification is located at MemoryKnowledge/openapi.yaml in the repository root.
  • The specification follows the OpenAPI 3.0.3 standard with complete endpoint and schema definitions.
  • The MemoryKnowledge/src/server.ts file implements runtime loading and serving of the specification via Swagger UI.
  • Production deployments package the spec using deploy/panel-knowledge-combined/Dockerfile.
  • You can generate client SDKs or host documentation using standard OpenAPI tools with the raw GitHub URL.

Frequently Asked Questions

What version of OpenAPI does the Knowledge service specification use?

The Knowledge service uses OpenAPI 3.0.3, as defined in the openapi.yaml file located in the MemoryKnowledge directory. This version supports modern schema definitions and comprehensive endpoint documentation required by the microservice architecture.

How do I access the Knowledge service OpenAPI specification programmatically?

You can access the raw specification via the GitHub raw content URL or by cloning the repository and reading MemoryKnowledge/openapi.yaml directly from the filesystem. The Knowledge service itself also serves the specification through the Swagger UI endpoints configured in MemoryKnowledge/src/server.ts.

Is the OpenAPI specification bundled into the Knowledge service Docker image?

Yes. The deploy/panel-knowledge-combined/Dockerfile explicitly copies MemoryKnowledge/openapi.yaml into the container at /app/knowledge/openapi.yaml. This ensures the specification is available for runtime documentation serving and internal service discovery.

Can I generate client SDKs from the Knowledge service specification?

Yes. The OpenAPI 3.0.3 specification in MemoryKnowledge/openapi.yaml is compatible with standard code generators. Use OpenAPI Generator or Swagger Codegen with the raw GitHub URL to produce typed clients in Java, TypeScript, Python, Go, and other supported languages.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →