Skip to content

Agent Factory SDK

Maintained source guide

Project-team quickstart

Use the existing agent_factory Python modules for agent definitions and single-target operator commands. This is different from the core team's azurefactory administration client. There is no separate published AgentFactoryClient to install.

1. Prepare your project copy

From the repository root, or use the equivalent copied directory aifactory-usecase-code\40-agent-factory in the repository of your project:

Set-Location .\usecase_code\40-agent-factory
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
.\.venv\Scripts\python.exe -m agent_factory --help

Keep your project configuration outside generated use-case code: copy config.example.json to aifactory\agent-factory\config.json, then have the operator resolve the target key, environment, variables-file path and selected storage profile. Do not run the unresolved example against Azure. See configuration ownership and storage selection.

2. Inspect agent definitions offline with Python

Save this as inspect_agents.py in the Agent Factory root and run .\.venv\Scripts\python.exe .\inspect_agents.py. It reads the maintained catalog without credentials, network access, model calls, deployment or local writes.

import json
from agent_factory.catalog import agent_catalog

agents = agent_catalog()
print(json.dumps([
    {"name": agent["name"], "kind": agent["kind"],
     "framework": agent["framework"], "role": agent["metadata"]["aifactory.role"]}
    for agent in agents
], indent=2))

The default catalog contains knowledge/reviewer/documentation prompt agents, hosted framework examples and a multi-agent helpdesk team. An entry defines an agent. It says nothing yet about what is deployed in your project. Read the real catalog, prompt agents, hosted examples and multi-agent examples.

3. Make an offline single-target plan

Save this separate program as plan_agents.py in the same directory. Supply the absolute path to your reviewed project configuration and its exact target key when prompted. plan validates your local configuration only. It doesn't sign in to Azure, look up resources or test the connection.

import json
from pathlib import Path
from agent_factory.cli import parser, run

config_path = Path(input("Reviewed configuration path: ").strip()).resolve(strict=True)
target_key = input("Exact target key from that configuration: ").strip()
if not target_key:
    raise ValueError("Select one target explicitly.")
arguments = parser().parse_args([
    "plan", "--config", str(config_path), "--target", target_key,
])
plan = run(arguments)
assert plan["mutations"] is False
print(json.dumps({"mutations": plan["mutations"],
                  "agents": [agent["name"] for agent in plan["agents"]]}, indent=2))

The equivalent CLI plan is also offline:

$config = Read-Host "Absolute reviewed configuration path"
$target = Read-Host "Exact target key"
.\.venv\Scripts\python.exe -m agent_factory plan --config $config --target $target

4. Optional live work: review before applying

Stop after the plan unless the operator has reviewed the target, existing Foundry/model resources, selected data account, dataset terms, private DNS, identity permissions and cost budget. discover and preflight read Azure; they are not offline tests. Ingestion, knowledge configuration and deployment are distinct mutations requiring --apply; invocation can incur model costs.

Follow the maintained operator commands and ingestion/knowledge/deployment sequence for one explicit --target. Ask your platform team before you enable public access, approve a private link or change a policy, and use the resource names of your project. Python integrations use the actual selection and command entry points, OAuth-backed project_client and prompt lifecycle and hosted deployment implementation; the operator CLI preserves the same ownership, storage and grounding checks.

For source-bound RAG use 45-rag-agent, not an unbounded storage scan. Continue with the ML Model Factory SDK when your project also trains models.