Skip to content

Agent cannot answer using knowledge #14

@dr4kedk

Description

@dr4kedk

Description

Add knowledge through API using md file, it's appear on database. But when ask agent about it, agent have no idea about that

To Reproduce

Steps to reproduce the behavior:

  1. Start the server and agent as normal and create new agent with knowledge plugin
    Use the API endpoint to create new agent, because default agent cannot load plugin knowledge
    Endpoint: localhost:3000/api/agents/
    Method: POST
    Request body
{
  "characterJson": {
    "name": "Alex",
    "bio": [
      "Engages with community members to ensure a positive experience.",
      "Handles inquiries and provides support.",
      "Facilitates discussions and resolves conflicts."
    ],
    "plugins": ["@elizaos/plugin-openai","@elizaos/plugin-bootstrap","@elizaos/plugin-sql","@elizaos/plugin-knowledge"],
    "system": "You are a community manager responsible for managing community interactions and queries.",
    "settings": {
      "secrets": {}
    },
    "lore": [
      "You have extensive knowledge of community management strategies."
    ],
    "messageExamples": [],
    "topics": ["community management", "user engagement", "conflict resolution"]
  }
}

Return 201 code with agent created data, let get this agent has id 64542dba-bb81-0fd4-86e0-cf4f319567c7

  1. Start agent
    Endpoint: localhost:3000/api/agents/64542dba-bb81-0fd4-86e0-cf4f319567c7
    Method: POST
    Return 200 code
{
    "success": true,
    "data": {
        "id": "64542dba-bb81-0fd4-86e0-cf4f319567c7",
        "name": "Alex",
        "status": "active"
    }
}
  1. Add knowledge for new agent
    Endpoint: localhost:3000/api/agents/64542dba-bb81-0fd4-86e0-cf4f319567c7/plugins/knowledge/documents
    Method: POST
    Request body: form-data
files: drake-simple.md

drake-simple.md file content

DrakeDinh is young developer who create Roxane agent.
DrakeDinh is 30 years old now and he will be 31 next year.

Response:

{
    "success": true,
    "data": [
        {
            "id": "a658bf79-d176-0b55-b731-8d9e3fc6bc4d",
            "filename": "drake-simple.md",
            "type": "text/markdown",
            "size": 150,
            "uploadedAt": 1749178954496,
            "status": "success"
        }
    ]
}

Knowledge appear in database

"2233c70e-6e03-4529-bc92-b574a8669c74"	"knowledge"	"2025-06-06 03:02:34.484137+00"	"{""text"": ""DrakeDinh is young developer who create Roxane agent.\nDrakeDinh is 30 years old now and he will be 31 next year.\nDrakeDinh's fullname is Dinh Le Long.""}"	"64542dba-bb81-0fd4-86e0-cf4f319567c7"	"64542dba-bb81-0fd4-86e0-cf4f319567c7"	"64542dba-bb81-0fd4-86e0-cf4f319567c7"	"64542dba-bb81-0fd4-86e0-cf4f319567c7"	true	"{""type"": ""fragment"", ""source"": ""rag-service-fragment-sync"", ""position"": 0, ""timestamp"": 1749178954438, ""documentId"": ""a658bf79-d176-0b55-b731-8d9e3fc6bc4d""}"
  1. Ask agent about DrakeDinh
    4.1 Try to use API
    Endpoint: localhost:3000/api/agents/64542dba-bb81-0fd4-86e0-cf4f319567c7/message
    Method: POST
    Request body:
{
    "entityId":"5adc5795-663f-4d1b-8e1e-cf1920483fb5", 
    "roomId":"64542dba-bb81-0fd4-86e0-cf4f319567c7",
    "source":"user-chat",
    "text":"Who is DrakeDinh",
    "channelType":"API"
}

Return 400 code

{
    "success": false,
    "error": {
        "code": "BAD_REQUEST",
        "message": "Missing or invalid global channelId in request body"
    }
}

Run into this error at 1.0.5 version, 1.0.4 is ok.
4.2 Try to use UI
After upgdate from 1.0.4 to 1.0.5, knowledge tab on agent disappear and i can't find it.
Try to ask : How old is DrakeDinh
Response: I'm sorry, but I don't have any information regarding the age of DrakeDinh. If you have any other questions or need assistance with something else, feel free to ask!

Expected behavior

  1. Chat with agent through API work like in 1.0.4, or update document about new require field "channelId" ...
  2. Agent can answer question about knowledge added
  3. Add knowledge tab in agent UI
  4. Can add/ search knowledge plugin in agent UI setting

Environment

"@elizaos/cli": "1.0.5",
"@elizaos/plugin-bootstrap": "1.0.5",
"@elizaos/plugin-knowledge": "1.0.1",
"@elizaos/plugin-sql": "latest",
Node version: v23.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions