AgentProfile
Portable agent profile definition — schema and parser.
AgentProfile defines a single PROFILE.md file that captures everything needed to instantiate an AI agent: identity metadata, model, tools, skills, system prompt, runtime limits, and pointers to companion config files. The format follows the SKILL.md convention — YAML frontmatter for metadata, Markdown body for the system prompt.
Installation
pip install agentprofile
Requires Python ≥ 3.11, < 3.14.
Quick start
Create a PROFILE.md:
---
name: research-assistant
description: Web research agent that summarizes findings with citations
model: gpt-4o-mini
tools:
- web_search
tags:
- research
---
You are a research assistant. Always cite sources with URLs.
Prefer primary sources. Be concise.
Load it:
from agentprofile import load_profile
profile = load_profile("PROFILE.md")
profile.name # "research-assistant"
profile.model # "gpt-4o-mini"
profile.tools # ["web_search"]
profile.system_prompt # "You are a research assistant. Always cite sources..."
Round-trip back to PROFILE.md:
from agentprofile import dumps_profile
md_text = dumps_profile(profile)
Or parse from a string (no file I/O):
from agentprofile import loads_profile
profile = loads_profile(md_text)
Format
A PROFILE.md has two parts:
- YAML frontmatter (between
---delimiters) — structured metadata - Markdown body — becomes the agent's
system_prompt(unless overridden by asystem_promptkey in frontmatter)
A file without frontmatter is treated entirely as the system prompt.
Frontmatter fields
| Field | Type | Default | Description |
|---|---|---|---|
version |
int | 1 |
Profile schema version |
name |
str | required | Agent name, 1–64 chars, [a-zA-Z0-9_-] only |
description |
str | "" |
Short human-readable description |
model |
str | "" |
Model identifier (e.g. gpt-4o-mini) |
tools |
list[str] | [] |
Tool names available to the agent |
skills |
list[str] | [] |
Skill references |
tags |
list[str] | [] |
Free-form tags |
handoff_instructions |
str | null | null |
Instructions when handing off to another agent |
system_prompt |
str | (body) | System prompt; defaults to Markdown body |
Runtime limits (harness-specific, optional)
| Field | Type | Default | Description |
|---|---|---|---|
max_llm_calls |
int | 50 |
Maximum LLM invocations per run |
cost_limit_usd |
float | 1.0 |
Spend cap per run |
timeout_seconds |
int | 300 |
Wall-clock timeout per run |
Companion files
Frontmatter can point to JSON files in the same directory as the profile; they are auto-loaded when the profile is loaded from disk:
| Pointer | Loads into | Purpose |
|---|---|---|
provider: provider.json |
profile.provider_options |
Provider/model configuration |
output_schema: output-schema.json |
profile.output_schema_def |
Structured output JSON Schema |
Companion contents are kept out of frontmatter serialization (exclude=True), so round-tripping a profile never leaks them into the .md.
profile = load_profile("agents/research/PROFILE.md")
profile.provider_options # dict from provider.json
profile.output_schema_def # dict from output-schema.json
When using loads_profile() on raw text, pass base_dir= to enable companion loading.
Behavior notes
- Validation:
namemust match^[a-zA-Z0-9_-]+$(1–64 chars);versionmust be ≥ 1. - Lenient parsing: unknown frontmatter keys are ignored (
extra="ignore"). - Serialization:
dumps_profile()omits defaults, nulls,system_prompt(moved to the body), and companion-file fields. Pointers (provider,output_schema) are also omitted since they reference sibling files.
API
| Function | Description |
|---|---|
load_profile(path) |
Parse a PROFILE.md from disk, auto-loading companion files |
loads_profile(text, base_dir=None) |
Parse from string; optional base_dir for companions |
dumps_profile(profile) |
Serialize an AgentProfile back to PROFILE.md text |
AgentProfile |
Pydantic model — see field tables above |
Development
uv sync # install deps + dev group
uv run pytest # run tests
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentprofile-0.2.1.tar.gz.
File metadata
- Download URL: agentprofile-0.2.1.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66426c5783f417ce118052f475093e6802c45510876b9f0a2aeacc3a1278f849
|
|
| MD5 |
16cb67d3a6493928fee3c81dc9bfec82
|
|
| BLAKE2b-256 |
f76810782bf78c17a3a7b9d9e3438618d8841e5775ce6a9994d16865f30538e7
|
File details
Details for the file agentprofile-0.2.1-py3-none-any.whl.
File metadata
- Download URL: agentprofile-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51a8a2e0863b8534d69237f9838a4f0db98db3fef2d7c96b8d4905099c07bc4c
|
|
| MD5 |
62304d79a6d7f1e3c04768523945660a
|
|
| BLAKE2b-256 |
a710aed4132a272e592f2802811079cab8c070f59733b91131f1fe8ab4decca8
|