Functions
Say
Add a message to a thread and get an agent’s response
The say
function adds a user message to a thread and gets an agent’s response. It transforms str → str
, making it easy to:
- Store messages in a thread (“My name is Alice” → thread.messages += [user_msg, agent_msg])
- Get contextual responses (“What’s my name?” → “Your name is Alice”)
- Guide agent behavior (“You are a chef…” → “Let me suggest a recipe…”)
For complex conversations, consider creating a custom task. The say
function is a convenient wrapper around Marvin’s task system - see Tasks for more details.
Usage
Add a message and get a response:
Parameters
message
: The message to add to the threadinstructions
: Optional guidance for the agent’s responsesagent
: Optional custom agent to usethread
: Optional thread to store conversation historycontext
: Optional additional context
Async Support
The function is also available in an async version:
Examples
With Instructions
Guide the agent’s responses:
With Custom Agent
Use a specialized agent:
With Memory
Remember previous interactions: