Commit graph

56 commits

Author SHA1 Message Date
leohpark
02b6e7013c
Update search_agent.py (#677)
Added missing word "be" in prompt instructions.

This is unlikely to change the agent functionality in most cases, but
optimal clarity in prompt language is a best practice.
2025-05-14 12:37:06 -04:00
Kazuhiro Sera
178020ea33
Examples: Fix financial_research_agent instructions (#573) 2025-04-22 22:29:12 -04:00
Rohan Mehta
a0254b0b74
RFC: automatically use litellm if possible (#534)
## Summary
This replaces the default model provider with a `MultiProvider`, which
has the logic:
- if the model name starts with `openai/` or doesn't contain "/", use
OpenAI
- if the model name starts with `litellm/`, use LiteLLM to use the
appropriate model provider.

It's also extensible, so users can create their own mappings. I also
imagine that if we natively supported Anthropic/Gemini etc, we can add
it to MultiProvider to make it work.

The goal is that it should be really easy to use any model provider.
Today if you pass `model="gpt-4.1"`, it works great. But
`model="claude-sonnet-3.7"` doesn't. If we can make it that easy, it's a
win for devx.

I'm not entirely sure if this is a good idea - is it too magical? Is the
API too reliant on litellm? Comments welcome.

## Test plan

For now, the example. Will add unit tests if we agree its worth mergin.

---------

Co-authored-by: Steven Heidel <steven@heidel.ca>
2025-04-21 15:03:06 -04:00
Rohan Mehta
e3698f32b1
Enable non-strict output types (#539)
See #528, some folks are having issues because their output types are
not strict-compatible.

My approach was:
1. Create `AgentOutputSchemaBase`, which represents the base methods for
an output type - the json schema + validation
2. Make the existing `AgentOutputSchema` subclass
`AgentOutputSchemaBase`
3. Allow users to pass a `AgentOutputSchemaBase` to
`Agent(output_type=...)`
2025-04-21 11:58:36 -04:00
Rohan Mehta
4b8472da7e
Examples for image inputs (#553) 2025-04-21 11:14:25 -04:00
Rohan Mehta
bd404e0f87
Litellm integration (#524)
litellm is a library that abstracts away details/differences for a lot
of model providers. Adding an extension, so that any provider can easily
be integrated.

---
[//]: # (BEGIN SAPLING FOOTER)
* #532
* __->__ #524
2025-04-16 18:48:41 -04:00
Rohan Mehta
f329eef7e8
Examples and tests for previous_response_id (#512)
Examples + tests
2025-04-15 12:46:31 -04:00
Rohan Mehta
5727a1c73a
Example for streaming guardrails (#505)
An example for the question in the issue attached - how to run
guardrails during streaming.

Towards #495.
2025-04-14 12:40:41 -04:00
nikkie
d089886f01
examples(research_bot): Add space to INSTRUCTIONS (#439)
Thanks to awesome example `research_bot`

Fix andproduce and goodgrammar (and so on)

```python
>>> from examples.research_bot.agents import search_agent
>>> print(search_agent.INSTRUCTIONS)
You are a research assistant. Given a search term, you search the web for that term andproduce a concise summary of the results. The summary must 2-3 paragraphs and less than 300words. Capture the main points. Write succinctly, no need to have complete sentences or goodgrammar. This will be consumed by someone synthesizing a report, so its vital you capture theessence and ignore any fluff. Do not include any additional commentary other than the summaryitself.
```
2025-04-08 14:01:09 -04:00
kanchi
869c95b012
Update computer-use example to support simultaneous key presses (#452)
### Summary

Updated the `computer-use` example to support simultaneous key presses.
The current implementation presses and releases keys one at a time,
which prevents combo inputs like copy (CTRL+C) from working correctly.

### Test plan

N/A

### Issue number

N/A

### Checks

- [ ] I've added new tests (if relevant)
- [ ] I've added/updated the relevant documentation
- [x] I've run `make lint` and `make format`
- [ ] I've made sure tests pass
2025-04-08 11:47:15 -04:00
Carmen(Jia) Liu
e827dfe75f
Fix: Correct the trace path in examples (#395)
### What changed?
The trace URL was using the wrong path format:
- Old: `/traces/{trace_id}`
- Fixed: `/traces/trace?trace_id={trace_id}`

<img width="781" alt="Screenshot 2025-03-30 at 5 54 11 pm"
src="https://github.com/user-attachments/assets/982fbb1d-7163-4438-b237-493e3100b5c7"
/>
2025-04-01 11:51:52 -04:00
Toufik Airane
757b7dafb1
Update README.md (#405)
fix typo
2025-04-01 11:50:40 -04:00
amri369
377ddbace6
Hotfix mcp example (#365)
Small typo in uv command fixed
2025-03-27 13:05:30 -04:00
Rohan Mehta
bd47a41d0b
MCP example for SSE (#354)
Simple example with a local SSE server.
2025-03-26 12:56:35 -04:00
Rohan Mehta
2261aabeeb
Adding Git MCP server example (#343)
- Adding new example showing a single agent interacting with local MCP
server for git
2025-03-25 19:54:59 -04:00
Rohan Mehta
b5ba22904a
[5/n] MCP tracing (#342)
## Summary:

Adds tracing and tests for tracing.
- Tools are added to the agents
- Theres a span for the mcp tools lookup
- Functions have MCP data

## Test Plan:

Unit tests
.
2025-03-25 19:54:28 -04:00
Dmitry Pimenov
5385f8b10e added readme, fixed typo 2025-03-25 16:52:52 -07:00
Dmitry Pimenov
88c8acbc5a fixing lint issues 2025-03-25 16:34:00 -07:00
Dmitry Pimenov
0944390c3f adding Git MCP server example 2025-03-25 16:30:50 -07:00
Rohan Mehta
010022777b [5/n] MCP tracing
## Summary:

Adds tracing and tests for tracing.
- Tools are added to the agents
- Theres a span for the mcp tools lookup
- Functions have MCP data

## Test Plan:

Unit tests
.
2025-03-25 19:28:48 -04:00
Dominik Kundel
2104f5400b fix(examples): make sure audio playback finishes 2025-03-25 12:11:33 -07:00
Rohan Mehta
de1e9a754d [3/n] Add an MCP stdio example
### Summary:
Spins up a stdio server with some local files, then asks the model questions.

### Test Plan:
Run the example, see it work.
2025-03-25 13:24:18 -04:00
Rohan Mehta
4cb011c4d2
Fix Typos (#258)
Noticed a bunch of typos when reading code, fixing.
2025-03-23 20:28:14 -04:00
Aviral Garg
fdf340495b Fix circular dependency in voice streamed example with cleaner import pattern 2025-03-21 16:26:19 -07:00
Aviral Garg
9473c788ba Fix type-checking for circular dependency in voice streamed example 2025-03-21 16:18:04 -07:00
Aviral Garg
7432347a94 Fix circular dependency in voice streamed example by renaming agents.py to my_workflow.py 2025-03-21 13:25:46 -07:00
Rohan Mehta
1771c1e856 update tests 2025-03-20 13:08:38 -04:00
Dominik Kundel
aec066649c fix tests 2025-03-20 09:52:15 -07:00
Dominik Kundel
c7ce154637 feat: add voice pipeline support
> Co-authored-by: rm@openai.com
2025-03-20 09:43:13 -07:00
Raduan77
65264b6b8a fix typos in /examples 2025-03-20 11:23:57 +01:00
Shyamal H Anadkat
0dec5712db Adds example for financial agent 2025-03-19 22:33:13 -07:00
Rohan Mehta
10aa5555af Introduce tool_use_behavior on agents 2025-03-18 21:55:12 -04:00
Rohan Mehta
2bff04719b
Fix handoffs example use cases (#156)
## Changes
- In this handoff example, we need to use `first_agent` with
`random_number_tool`, instead of `second_agent` without that tool, since
the user is asking to generate a random number.
- fixed typo in comments
2025-03-17 15:59:18 -04:00
Rohan Mehta
fad23f1a3d
fix typo in agent_lifecycle_example.py (#161) 2025-03-17 15:59:00 -04:00
Rohan Mehta
83ec26d200
fix reasoning order in examples (#186)
I think we need to put reasoning-related outputs first to encourage CoT
reasoning.
2025-03-17 15:57:52 -04:00
heartkilla
54a48a3967 fix reasoning order in examples 2025-03-17 14:56:43 +09:00
Rohan Mehta
09d70c074d utils directory 2025-03-16 18:48:45 -04:00
CCM
8540b1e65b
fix typo in agent_lifecycle_example.py 2025-03-14 19:14:26 +08:00
Kento Yamanaka
792cdea464 fix: use first_agent instead of second_agent for a task to generate random number 2025-03-13 18:26:49 -07:00
Rohan Mehta
6ab8c91d23 Update custom models to use tools 2025-03-13 13:10:26 -04:00
Rohan Mehta
16cfce117c
Add examples and documentation for using custom model providers (#110) 2025-03-13 08:17:25 -07:00
Rohan Mehta
25a633139d Add examples and documentation for using custom model providers 2025-03-12 17:34:38 -07:00
Dmitry Pimenov
26f9cb42de fixing mypy error 2025-03-12 17:30:59 -07:00
Dmitry Pimenov
65546703cb fixing lint issues 2025-03-12 17:28:44 -07:00
Dmitry Pimenov
536d7826d5 added a Jupyter example to clarify how to use the SDK with an existing event loop 2025-03-12 17:24:35 -07:00
Harsh Jain
f0f93dbe0b Fix guardrail trigger in input_guardrails.py
Remove the `not` keyword from the `tripwire_triggered` parameter in the `math_guardrail` function in `examples/agent_patterns/input_guardrails.py`.

The not keyword prevented the guardrail from being triggered, which defeats the purpose of the example.
2025-03-12 18:10:28 +05:30
Ali Yaman
fce4872f32 docs: Fix typos in documentation files 2025-03-12 00:12:31 +01:00
Rohan Mehta
37577d33f4 make computer use example less verbose 2025-03-11 15:27:08 -07:00
Rohan Mehta
96dd792146
Merge pull request #27 from openai/rm/fixes
Cleanup some more excess files
update gitignore, pycache
run make format
2025-03-11 14:55:31 -07:00
Rohan Mehta
c8087180ae
Merge pull request #3 from pierDipi/fix-guardrails-link
Fix guardrails examples link
2025-03-11 13:28:17 -07:00