Corvic AI Python Integration Example
This example demonstrates how to use the Corvic AI MCP protocol in Python to query a deployed agent that processes PDF-based enterprise data.
Use Case
We will ask a question that requires the Corvic agent to look up and reason through a NAICS (North American Industry Classification System) PDF document.
Prerequisites
- Complete the setup steps in this blog post.
- Upload the NAICS 2022 Manual PDF and deploy your agent on Corvic's platform.
- Once deployed, copy the MCP endpoint and access token.
Integration Steps
- Use the
mcpPython package to create ansse_clientconnection to the deployed agent. - Pass the MCP endpoint and your API token in the request headers.
- Initialize the session and retrieve the list of available tools (Corvic currently supports a single tool:
query). - Call the
querytool with your question via thequery_contentargument. - Save the response to a markdown file for review.
Question Asked
Map the NAICS code 441228 from 2017 to the 2022 NAICS code.The following Python code demonstrates the integration:
python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Response
The response will look as below. The mapping as well as the relevant section of the document is retrieved by the Corvic agent.

Notes
- The
query_contentargument is required. - Replace the placeholder token with your actual Corvic API token.
- You can save or manipulate the response as needed (e.g., convert to HTML, display in UI, etc).
Need help? Contact support@corvic.ai or visit https://www.corvic.ai.