Bailian managed agent IaC (bl managed-agent)
CRITICAL — Before executing, MUST read the shared protocol in ../bailian-protocol/SKILL.md: Version & updates (pre-flight checklist) and CLI errors: report an issue. Command details are authoritative in reference/managed-agent.md and bl managed-agent --help — do not guess flags. If that protocol file is missing, stop and run npx skills add modelstudioai/cli --all -g; do not guess auth/consent.
Safety guardrail (the most important rule)
apply / destroy mutate remote resources and only execute when --yes is passed:
- Always run
bl managed-agent planfirst and show the diff to the user. - Only after explicit user confirmation, retry
apply/destroywith--yes. - Never add
--yeson your own initiative before the user has confirmed.
IaC lifecycle
1. Init bl managed-agent init # scaffold agents.yaml
2. Validate bl managed-agent validate # offline, no network calls
3. Preview bl managed-agent plan # show the pending change diff
4. Apply bl managed-agent apply --yes # only after user confirmation
5. Destroy bl managed-agent destroy --yes # only after user confirmation
Session interaction (chat with a deployed managed agent)
| Intent | Command |
|---|---|
| Create + send + stream in one step | bl managed-agent session run |
| Send a message to an existing session | bl managed-agent session send |
| Create / inspect / list sessions | bl managed-agent session create / get / list |
| List session event history | bl managed-agent session events |
| Delete a session | bl managed-agent session delete |
Local state management
| Intent | Command |
|---|---|
| Inspect tracked resources | bl managed-agent state list / show |
| Adopt an existing remote resource to state | bl managed-agent state import |
| Untrack only (do not destroy remotely) | bl managed-agent state rm |
- Always make the difference clear to the user:
state rmonly edits the local state file, whiledestroydeletes the remote resource.
Flags, usage, and examples: see reference/ or bl <command> --help — do not guess flags.
Common hand-offs
软 hand-off(按 skill 名;已安装则 Read,否则 --help / 提示 npx skills add modelstudioai/cli --all -g):
- Call an already published Bailian app/assistant →
bailian-app-call, or skillbailian-cli(bl app list/call; fallback:bl app --help). - Choosing the model referenced in agents.yaml →
bailian-model-recommend. - Deployment quota / billing questions → skill
bailian-cli(fallback:bl quota/bl usage --help).
references
- bailian-protocol — shared protocol (install via
--all -g) - reference/ — command details










