# Knowledge Bases ## Attach `agents.knowledge_bases.attach(stragent_uuid) -> APILinkKnowledgeBaseOutput` **post** `/v2/gen-ai/agents/{agent_uuid}/knowledge_bases` To attach knowledge bases to an agent, send a POST request to `/v2/gen-ai/agents/{agent_uuid}/knowledge_bases` ### Parameters - **agent\_uuid:** `str` ### Returns - `APILinkKnowledgeBaseOutput` ### Example ```python from gradient import Gradient client = Gradient() api_link_knowledge_base_output = client.agents.knowledge_bases.attach( "agent_uuid", ) print(api_link_knowledge_base_output.agent) ``` ## Attach Single `agents.knowledge_bases.attach_single(strknowledge_base_uuid, KnowledgeBaseAttachSingleParams**kwargs) -> APILinkKnowledgeBaseOutput` **post** `/v2/gen-ai/agents/{agent_uuid}/knowledge_bases/{knowledge_base_uuid}` To attach a knowledge base to an agent, send a POST request to `/v2/gen-ai/agents/{agent_uuid}/knowledge_bases/{knowledge_base_uuid}` ### Parameters - **agent\_uuid:** `str` - **knowledge\_base\_uuid:** `str` ### Returns - `APILinkKnowledgeBaseOutput` ### Example ```python from gradient import Gradient client = Gradient() api_link_knowledge_base_output = client.agents.knowledge_bases.attach_single( knowledge_base_uuid="\"123e4567-e89b-12d3-a456-426614174000\"", agent_uuid="\"123e4567-e89b-12d3-a456-426614174000\"", ) print(api_link_knowledge_base_output.agent) ``` ## Detach `agents.knowledge_bases.detach(strknowledge_base_uuid, KnowledgeBaseDetachParams**kwargs) -> KnowledgeBaseDetachResponse` **delete** `/v2/gen-ai/agents/{agent_uuid}/knowledge_bases/{knowledge_base_uuid}` To detach a knowledge base from an agent, send a DELETE request to `/v2/gen-ai/agents/{agent_uuid}/knowledge_bases/{knowledge_base_uuid}`. ### Parameters - **agent\_uuid:** `str` - **knowledge\_base\_uuid:** `str` ### Returns - `class KnowledgeBaseDetachResponse` Informatinon about a unlinked knowledge base - **agent:** `Optional[APIAgent]` An Agent ### Example ```python from gradient import Gradient client = Gradient() response = client.agents.knowledge_bases.detach( knowledge_base_uuid="\"123e4567-e89b-12d3-a456-426614174000\"", agent_uuid="\"123e4567-e89b-12d3-a456-426614174000\"", ) print(response.agent) ``` ## Domain Types ### API Link Knowledge Base Output - `class APILinkKnowledgeBaseOutput` Information about a linked knowledge base - **agent:** `Optional[APIAgent]` An Agent