> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Knowledge Search

> Search the knowledge base and list stored content

**1. Create a Python file**

```python knowledge_search.py theme={null}
import asyncio

from agno.client import AgentOSClient


async def main():
    client = AgentOSClient(base_url="http://localhost:7777")

    print("=" * 60)
    print("Knowledge Search")
    print("=" * 60)

    # Get knowledge configuration
    print("\n1. Getting knowledge config...")
    try:
        config = await client.get_knowledge_config()
        print(f"   Available readers: {config.readers if hasattr(config, 'readers') else 'N/A'}")
        print(f"   Available chunkers: {config.chunkers if hasattr(config, 'chunkers') else 'N/A'}")
    except Exception as e:
        print(f"   Knowledge not configured: {e}")
        return

    # List existing content
    print("\n2. Listing content...")
    try:
        content = await client.list_knowledge_content()
        print(f"   Found {len(content.data)} content items")
        for item in content.data[:5]:
            print(f"   - {item.id}: {item.name if hasattr(item, 'name') else 'Unnamed'}")
    except Exception as e:
        print(f"   Error listing content: {e}")

    # Search knowledge base
    print("\n3. Searching knowledge base...")
    try:
        results = await client.search_knowledge(
            query="What is Agno?",
            limit=5,
        )
        print(f"   Found {len(results.data)} results")
        for result in results.data:
            content_preview = str(result.content)[:100] if hasattr(result, "content") else "N/A"
            print(f"   - Score: {result.score if hasattr(result, 'score') else 'N/A'}")
            print(f"     Content: {content_preview}...")
    except Exception as e:
        print(f"   Error searching: {e}")


if __name__ == "__main__":
    asyncio.run(main())
```

<Snippet file="create-venv-step.mdx" />

**2. Install dependencies**

```bash theme={null}
uv pip install -U agno openai
```

**3. Export your OpenAI API key**

```bash Mac/Linux theme={null}
export OPENAI_API_KEY="your_openai_api_key_here"
```

```bash Windows theme={null}
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

**4. Start an AgentOS Server**

Start the [client example server](https://agno-v2.mintlify.site/examples/agent-os/python-client/-server.md) on port 7777. It registers the knowledge base used by this client.

**5. Upload content**

[Upload at least one content item](https://agno-v2.mintlify.site/examples/agent-os/python-client/knowledge.md) before searching the knowledge base.

**6. Run the Client**

```bash Mac theme={null}
python knowledge_search.py
```

```bash Windows theme={null}
python knowledge_search.py
```


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