---
title: "Store Knowledge"
method: POST
path: "/store_knowledge"
tags: ["knowledge"]
---

# Store Knowledge

`POST /store_knowledge`

Store and process agent interaction knowledge asynchronously.

This endpoint accepts knowledge about agent interactions and queues it for background
processing. The processing pipeline analyzes the interaction, generates insights,
and stores them for future use.

Args:
    knowledge: Details about the agent interaction including:
        - tenant_id: Tenant identifier for organization/project
        - query: The user's original query/request
        - turns: List of interaction turns between user and agent
        - success: Whether the interaction achieved the user's goal
        - agent_type: Type of agent that handled the interaction
        - timestamp: When the interaction occurred (ISO format)
    background_tasks: FastAPI background tasks handler for async processing

Returns:
    Dict containing:
        - status: "accepted"
        - message: Processing acknowledgement
        - tenant_id: The tenant ID from the request

Notes:
    - Each turn should capture the key decision points and context
    - The memory field helps track the agent's understanding
    - Success should reflect whether the user's goal was achieved
    - Timestamp should be in ISO 8601 format
    - Agent type helps categorize different interaction patterns

Raises:
    HTTPException(500): If there is an error queueing the knowledge

## Request body

- AgentKnowledgeUpload — Represents uploaded knowledge about agent interactions.
  - `tenant_id` string, required — Unique identifier for the tenant/user
  - `query` string, required — The original user query or instruction
  - `turns` AgentTurn[], required — The sequence of agent turns
    - `turn` integer, required — The turn number in the interaction
    - `inputs` string, required — The flattened input the agent sees
    - `decision` string, required — The output/action of the agent
    - `memory` string, nullable — What the agent remembers from this turn
    - `result` string, nullable — The result of the action
  - `success` boolean, nullable — Whether the agent completed its task successfully
  - `agent_type` string, nullable — Type of agent (e.g., 'browser', 'voice')
  - `timestamp` string, date-time
  - `metadata` object, nullable

## Response `202`

Successful Response

- object

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/osmosis/apis/osmosis-agent-improvement-api.md) · [All operations](https://skmtc.net/osmosis/apis/osmosis-agent-improvement-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/osmosis/osmosis-agent-improvement-api/versions/1776d48631c4/schema)
