Back to prompt library
Initial Agent Definition with Tools
Linked challenge: Build a Proactive Executive Assistant Agent with OpenAI Agents SDK
Prompt source
planning31 lines4 sectionsNo variables1 code block
Using the OpenAI Agents SDK, define an initial `Assistant` with a `GPT-4o` model. Create a `tool` definition for scheduling calendar events (e.g., `schedule_calendar_event(title: str, start_time: str, end_time: str, attendees: list[str])`) and for sending short emails (e.g., `send_short_email(recipient: str, subject: str, body: str)`). Your agent should be instructed to act as a proactive executive assistant.
```python
from openai import OpenAI
client = OpenAI()
assistant = client.beta.assistants.create(
name='Executive Assistant',
instructions='You are a proactive executive assistant. Your goal is to manage the user\'s schedule, communications, and information flow efficiently. Always confirm actions before executing, unless explicitly told otherwise.',
model='gpt-4o',
tools=[
{
'type': 'function',
'function': {
'name': 'schedule_calendar_event',
'description': 'Schedules a new event on the user\'s calendar.',
'parameters': {
'type': 'object',
'properties': {
'title': {'type': 'string', 'description': 'Title of the event'},
'start_time': {'type': 'string', 'format': 'date-time', 'description': 'Start time in ISO 8601 format'},
'end_time': {'type': 'string', 'format': 'date-time', 'description': 'End time in ISO 8601 format'},
'attendees': {'type': 'array', 'items': {'type': 'string'}, 'description': 'List of email addresses of attendees'}
},
'required': ['title', 'start_time', 'end_time', 'attendees']
}
}
},
# Add send_short_email tool definition here
]
)
print(assistant)
```