mythic-container library provides the v4 chat base class and response helpers.
Minimal container
chat(msg) call handles one Mythic request. An approval or input continuation arrives as a new ChatRequest, not as a callback into the old coroutine.
Request shape
Streaming response shape
response_key for updates to the same visible block. Use another key for tool cards, approval cards, or a separate final answer.
Human-in-the-loop and tools
Well-knownmetadata.special_type values let Mythic render native UI:
tool_usefor tool progress and lazily fetched full output;mcp_tool_confirmationfor an approval before a write-capable MCP call;input_requestedfor free-form or choice-based operator input;subagentfor delegated work grouped bydelegation_id.
Cancellation
The library tracks active request tasks and cancels them when Mythic sends a cancellation. Provider clients should propagate cancellation to their HTTP/streaming call and avoid sending a second terminal completion after cancellation. For a complete reference implementation, use thebasic_chat example and the CHAT_CONTAINERS.md guide in the MythicContainerPyPi repository matching your installed library version.