Private beta · Early access
Cookbook
Inbox actions
Read a new email, choose one of your known actions, and draft the reply.
Private beta. InferenceIndex is changing fast. Models, endpoints, pricing and these docs may change without notice, so check back before you build on a detail.
An assistant agent sorts incoming email into a short list of actions, such as reschedule, reply, file, or hand off to a person, and drafts the response. Each email is new, but the set of actions and the way you handle each one stay the same.
The job
- New each run: the sender, the request, and the dates and names in it.
- Same each run: your list of actions, your tone, and the fields your product needs to carry out the action.
The call
python
import json
from openai import OpenAI
client = OpenAI(api_key="YOUR_KEY", base_url="https://inferenceindex-skills-25534459979.us-east4.run.app/v1")
SKILL_ID = "skl_YOUR_SKILL_ID" # this job, saved once as a skill
ACTIONS = """Choose one action: reschedule, reply, file, handoff.
Return JSON with keys: action, reason, reply_draft,
and for reschedule also proposed_window (string)."""
def handle(email: str, calendar_summary: str) -> dict:
response = client.chat.completions.create(
model="inferenceindex-0.1/" + SKILL_ID,
messages=[
{"role": "system", "content": "You manage a busy founder's inbox. " + ACTIONS},
{"role": "user", "content": f"Calendar:\n{calendar_summary}\n\nEmail:\n{email}"},
],
)
return json.loads(response.choices[0].message.content)What comes back
An example reply for "Can we move Thursday to next week?":
json
{
"action": "reschedule",
"reason": "Client asked to move Thursday's call.",
"proposed_window": "Tue or Wed next week, 10:00-12:00",
"reply_draft": "Happy to move it. Does Tuesday or Wednesday morning next week work?"
}In production
- Your code still does the action itself: it sends the email, moves the event, or files the thread. The model picks the action and drafts the text.
- Keep the action list fixed. Requests for an action that isn't on the list can go to your fallback model.
- An email that doesn't fit any action goes to your fallback model.