Browse the docs

Test the agent locally

Run the phased smoke test and the credential diagnostics, then smoke-test the container over HTTP.

Before you startA filled-in `.env` and Python 3.12 with the agent's dependencies installed.View as Markdown

Check the generated code parses

bash
cd azurefoundry_report_generator_skills
python -c "import ast; [ast.parse(open(f).read()) for f in ['__main__.py','claude_skills_agent.py','claude_skills_agent_executor.py','http_agent_server.py']]"

A parse error here is real: every placeholder should be filled by now.

The diagnostic scripts

tests/ holds five standalone scripts. Each loads ../.env, so you do not re-export credentials. Run them from the tests/ directory. If everything is healthy you only need test_run.py; use the others to isolate a failure when it stops partway.

#ScriptWhat it isolates
1test_foundry_direct.pyResource URL, key, model deployment, and auth header style, over plain HTTP with no SDK. Tries api-key, x-api-key, and Authorization: Bearer until one returns 200.
2test_anthropic_sdk_foundry.pyThe anthropic package's Foundry client, bypassing claude-agent-sdk. If this works and the agent does not, the problem is in the agent SDK layer.
3inspect_foundry_client.pyWhat AnthropicFoundry.__init__ expects for resource, and the base URL each candidate format produces.
4debug_sdk.py [model]claude-agent-sdk end to end with every message dumped. Use it when test_run.py Phase 1 fails with a vague error.
5test_run.pyPhases 0 to 3: env, SDK auth, skill discovery, adapter wiring.

The phased smoke test

bash
cd azurefoundry_report_generator_skills/tests
python test_run.py
PhaseChecksExit code on failure
0: env sanityANTHROPIC_API_KEY is set; in Foundry mode, ANTHROPIC_FOUNDRY_RESOURCE too.1
1: SDK authA one-turn query() with no tools returns text (PING).2
2: skill discoveryCopies the skill into a temp .claude/skills/<skill-name>/, asks the SDK to list its skills, and checks the name appears.3
3: adapter wiringRuns your agent class in an empty temp cwd, so the skill is not invoked, and checks the first event starts with 🤖, and the last is not an error. It also reports whether token usage was captured, without failing on it.4

Exit code 0 means every phase passed. Phase 3 avoids the skill on purpose, so it works on Windows even when the skill hardcodes Linux paths. What the smoke test does not cover: running the skill end to end when its scripts need Linux paths, the full HTTP /execute NDJSON path, and volume-mounted outputs. Use the container for those.

Smoke-test the container (plain HTTP)

bash
# From the repo root
docker build -f azurefoundry_report_generator_skills/Dockerfile -t report-generator-skills-agent-test .

docker run --rm -it \
  -p 9024:9024 \
  --env-file azurefoundry_report_generator_skills/.env \
  -v "${PWD}/outputs:/outputs" \
  report-generator-skills-agent-test

curl http://localhost:9024/health

curl -X POST http://localhost:9024/execute \
  -H 'Content-Type: application/json' \
  -d '{"context_id":"t1","task_id":"t1","message":"Build a test report"}'

Smoke-test the container (AMC variant)

bash
docker run --rm -it -p 8080:8080 --env-file .env report-generator-skills-agent-test

curl -i http://localhost:8080/health            # 200 when ready, 503 when not
curl http://localhost:8080/workflows

curl -X POST http://localhost:8080/runs \
  -H 'Content-Type: application/json' \
  -d '{"inputs": {"topic": "weekly"}}'           # returns orchestratorRunId

curl http://localhost:8080/runs/<orchestratorRunId>/status
curl -N http://localhost:8080/runs/<orchestratorRunId>/events
curl http://localhost:8080/runs/<orchestratorRunId>/tokens

Check that the completed step on /status carries inputTokens, outputTokens, and a model, and that /tokens is not zero. Those are what AMC prices.

Last updated 2026-10-21