def fetch_agent_doc()

in components/webui/src/dpu/api.py [0:0]


def fetch_agent_doc(doc_id: str) -> Optional[dict]:
    logger.info(f"Fetching doc id {doc_id}")
    client = document_service_client()

    # Fetch document
    response = document_service_client().get_document(
        request=discoveryengine.GetDocumentRequest(
            name=client.document_path(
                project=PROJECT_ID,
                location=LOCATION,
                data_store=SEARCH_DATASTORE_ID,
                branch="default_branch",
                document=doc_id,
            )
        )
    )

    doc = _document_to_dict(response)

    return doc