> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Knowledge Add • AI Agent SDK

> knowledge_add: Emit knowledge add event for tracking knowledge indexing.

# knowledge\_add

Method

> This is a method of the [**ContextTraceEmitter**](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/ContextTraceEmitter.md) class in the [**context\_events**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/context_events.md) module.

Emit knowledge add event for tracking knowledge indexing.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def knowledge_add(agent_name: str, source: str, chunk_count: int, metadata: Optional[Dict[str, Any]]) -> None
```

## Parameters

**agent\_name** `str` *required*

Name of the agent adding knowledge

**source** `str` *required*

Source file/URL being indexed

**chunk\_count** `int` *required*

Number of chunks created

**metadata** `Optional`

Optional metadata about the indexing

## Uses

* `ContextEvent`
* `time.time`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/trace/context_events.py#L1485)
>
> `praisonaiagents/trace/context_events.py` at line 1485

***

## Related Documentation

> [card] [Knowledge Concept](https://praison.ai/docs/docs/concepts/knowledge)

> [card] [Knowledge Overview](https://praison.ai/docs/docs/knowledge/overview)

> [card] [Knowledge Configuration](https://praison.ai/docs/docs/configuration/knowledge-config)

> [card] [Chat with PDF](https://praison.ai/docs/docs/knowledge/chat-with-pdf)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.