mirror of
https://github.com/langchain-ai/agents-from-scratch-ts.git
synced 2026-07-01 21:34:00 -04:00
20 lines
605 B
Python
20 lines
605 B
Python
from typing import Literal
|
|
from pydantic import BaseModel
|
|
from langchain_core.tools import tool
|
|
|
|
@tool
|
|
def write_email(to: str, subject: str, content: str) -> str:
|
|
"""Write and send an email."""
|
|
# Placeholder response - in real app would send email
|
|
return f"Email sent to {to} with subject '{subject}'"
|
|
|
|
@tool
|
|
def triage_email(category: Literal["ignore", "notify", "respond"]) -> str:
|
|
"""Triage an email into one of three categories: ignore, notify, respond."""
|
|
return f"Classification Decision: {category}"
|
|
|
|
@tool
|
|
class Done(BaseModel):
|
|
"""E-mail has been sent."""
|
|
done: bool
|