Internal Models
fast-agent comes with two internal models to aid development and testing: passthrough
and playback
.
Passthrough
By default, the passthrough
model echos messages sent to it.
Fixed Responses
By sending a ***FIXED_RESPONSE <message>
message, the model will return <message>
to any request.
Tool Calling
By sending a ***CALL_TOOL <tool_name> [<json>]
message, the model will call the specified MCP Tool, and return a string containing the results.
Playback
The playback
model replays the first conversation sent to it. A typical usage may look like this:
---USER
Good morning!
---ASSISTANT
Hello
---USER
Generate some JSON
---ASSISTANT
{
"city": "London",
"temperature": 72
}
This can then be used with the prompt-server
you can apply the MCP Prompt to the agent, either programatically with apply_prompt
or with the /prompts
command in the interactive shell.
Alternatively, you can load the file with load_message_multipart
.
JSON contents can be converted to structured outputs:
@fast.agent(name="playback",model="playback")
...
playback_messages: List[PromptMessageMultipart] = load_message_multipart(Path("playback.txt"))
# Set up the Conversation
assert ("HISTORY LOADED") == agent.playback.generate(playback_messages)
response: str = agent.playback.send("Good morning!") # Returns Hello
temperature, _ = agent.playback.structured("Generate some JSON")
When the playback
runs out of messages, it returns MESSAGES EXHAUSTED (list size [a]) ([b] overage)
.
List size is the total number of messages originally loaded, overage is the number of requests made after exhaustion.