Microsoft Foundry — Foundry SDK + Neo4j
Investment research agent driven from code with the Foundry SDK Responses API. Tools are narrow Python functions that run pre-baked Cypher against Neo4j directly — your app owns every query. No MCP server, no generic read-cypher exposed to the model.
Tool names and return shapes follow the EXAMPLE_AGENT.md spec ("Industry Research Agent"). Cypher uses the actual companies demo schema underneath.
When to pick this path
-
You want tight control over which graph queries the model can run.
-
Connection pooling and secrets stay on the app side.
-
Every query is a literal Python function you wrote — easy to audit, easy to add.
For a reusable MCP endpoint that any Foundry / Copilot Studio / Agent Framework agent can attach, use examples/mcp instead.
Run
cd microsoft-foundry/infra
./deploy.sh # one-time, opt in to Foundry at the prompt
cd ../examples/foundry-sdk
uv run foundry_sdk_neo4j.py
uv reads the inline dependency block at the top of the script (azure-ai-projects, azure-identity, openai, python-dotenv, neo4j), provisions an isolated environment, and runs. No requirements.txt, no virtualenv, no exports. The script reads microsoft-foundry/.env for everything (Foundry endpoint, Azure tenant, Neo4j credentials).
Function tools
Ten read-only functions over the public companies demo graph, organised the way the agent picks them:
Discovery
| Tool | Returns |
|---|---|
|
up to 20 fuzzy name matches via the |
|
every |
|
up to 10 companies in a category, with |
Profile
| Tool | Returns |
|---|---|
|
primary lookup: |
Network
| Tool | Returns |
|---|---|
|
1–2 hop org-to-org connections ( |
|
people associated with the company and their roles |
News
| Tool | Returns |
|---|---|
|
up to 5 articles mentioning the company, with |
|
up to 25 articles in the calendar month starting at |
|
full article body (joined from chunks), summary, sentiment, source |
|
companies mentioned in an article, with |
To add a tool: write a Python function with typed parameters and a docstring, then add it to TOOL_IMPLS. The function_tool() helper auto-generates the strict JSON schema from the function’s signature and docstring.
Expected output
> Tell me about Microsoft — its industry, who runs it, and where it's
based. Then suggest three peers in the same industry.
→ query_company(company_name='Microsoft')
→ companies_in_industry(industry='Software Companies')
### Microsoft Overview
- **Industry**: Software Companies
- **Leadership**: CEO is **Satya Nadella**
- **Headquarters Locations**: Mississauga, Halifax, Calgary
### Suggested Peers in the Software Industry:
1. **Sutter Mills**
2. **Ivalua**
3. **Catchpoint Systems**
How it authenticates
-
You → Foundry:
AzureCliCredentialpinned toAZURE_TENANT_IDfrom.envso it works whenaz loginis logged into multiple tenants. -
You → Neo4j: the
neo4jPython driver with username/password from.env. Defaults tocompanies/companiesagainst the public demo graph.
No Foundry tokens or Neo4j credentials are passed through the model — it sees only the tool schemas and the rows you return.
Override knobs
Set these in microsoft-foundry/.env:
| Variable | Default | Purpose |
|---|---|---|
|
"Tell me about Microsoft…" |
The single user question. |
|
|
Agent version name (created and deleted each run). |
|
|
Model to run the agent on. |
|
demo graph |
Point at your own Aura or self-managed Neo4j. |
Coming later
The spec also defines a vector-search variant of search_news and find_influential_companies (PageRank). Both are intentionally out of scope here:
-
Vector
search_news`needs an embedding-model deployment in the Foundry account; the default `azd up provisions onlygpt-4o-mini. The MENTIONS-based version above already covers the news-discovery use case for the demo data. -
`find_influential_companies` uses Neo4j Graph Data Science with write access to project an in-memory graph; the public demo database is read-only.