14. The Client API#
14.1. The constructor#
If you have already built an AutoGen-compatible model client, construct
MetadataReviewerClient directly:
MetadataReviewerClient(
model_client, # a pre-built AutoGen ChatCompletionClient
assets_dir=None, # directory holding agent-manifest YAML files
)
Parameter |
Description |
|---|---|
|
Any object implementing AutoGen’s |
|
Optional path to a directory of manifest YAML files. Defaults to the |
Note
assets_dir vs. manifest_file
The directory of manifests is set once, on the constructor via
assets_dir. The specific file to use is chosen per submission via
the manifest_file argument to submit(). Do not pass assets_dir to
submit() — it is not a parameter there.
14.2. Factory classmethods#
These four classmethods cover the common providers. All four also accept
the optional assets_dir argument.
14.2.1. from_openai#
Parameter |
Description |
|---|---|
|
Model name, e.g. |
|
Your OpenAI API key. |
For reproducibility the client is built with a fixed seed=1029 and
temperature=0 (or 1 for gpt-5 models, which require it). It also
advertises JSON / structured-output support to AutoGen.
14.2.2. from_anthropic#
Parameter |
Description |
|---|---|
|
Model name, e.g. |
|
Your Anthropic API key. |
14.2.3. from_azure#
Parameter |
Description |
|---|---|
|
Model name, e.g. |
|
Azure OpenAI endpoint URL. |
|
Azure deployment name. |
|
API version string, e.g. |
|
Optional token-provider callable from |
|
Optional static Azure AD token; use when no provider is available. |
14.2.4. from_ollama#
Parameter |
Description |
|---|---|
|
Model name, e.g. |
|
Host of the Ollama server. Defaults to |
|
Port of the Ollama server. Defaults to |
14.3. Submitting jobs: submit vs. submit_async#
Both methods accept the same arguments and return a Job immediately. They differ only in how the pipeline is scheduled.
Argument |
Description |
|---|---|
|
The metadata to scan, as a dict or a JSON string. |
|
Name of the YAML manifest file inside |
|
AutoGen team routing strategy (see Advanced Usage). Defaults to |
Method |
Use when |
|---|---|
|
You are in ordinary synchronous code (a script, a REPL, a notebook). The pipeline runs in a daemon thread with its own event loop, so it is safe to call even when no event loop exists. |
|
You are already inside an async context. It schedules the pipeline as an asyncio Task in the current event loop. |
Synchronous example:
job = client.submit(metadata, team_preset="RoundRobinGroupChat")
result = job.wait_sync(timeout=300)
Asynchronous example:
async def review(metadata):
job = await client.submit_async(metadata)
return await job.wait(timeout=300)
14.4. Job-management methods#
The client tracks every job it creates so you can look them up later.
Method |
Description |
|---|---|
|
Return the Job with the given ID, or raise |
|
Return all tracked jobs. |
|
Remove finished jobs from the registry and return how many were removed. By default it keeps only pending and running jobs. |
|
Return the available YAML manifest file names found in |
# discard everything that has finished, keeping only active jobs
removed = client.cleanup_jobs()
print(f"Cleared {removed} finished jobs")
# which manifests are available?
print(client.list_manifests()) # ['default_agents_manifest.yml', ...]