|
2 | 2 |
|
3 | 3 | <div class='subtitle'>Get your agent ready for testing</div> |
4 | 4 |
|
5 | | -Invariant `testing` relies on a very simple yet powerful trace format as the common denominator for testing agents. |
| 5 | +`testing` works with a simple yet powerful trace format as the common denominator for testing agents. |
6 | 6 |
|
7 | | -This trace format is a list of dictionaries, where each dictionary represents a message in the conversation. Each message has a `role` key that specifies the role of the speaker (e.g., `user` or `agent`) and a `content` key that contains the message content. |
| 7 | +This trace format is a list of dictionaries, where each dictionary represents a message in the conversation. It is equivalent to the [OpenAI chat format](https://platform.openai.com/docs/api-reference/chat/create). |
| 8 | + |
| 9 | +Each message has a `role` key that specifies the role of the speaker (e.g., `user` or `assistant`) and a `content` key that contains the message content. |
8 | 10 |
|
9 | 11 | ```json |
10 | | -{"role": "user", "content": "Hello there"}, |
11 | | -{"role": "assistant", "content": "Hello there", "tool_calls": [ |
12 | | - { |
13 | | - "type": "function", |
14 | | - "function": { |
15 | | - "name": "greet", |
16 | | - "arguments": { |
17 | | - "name": "there" |
| 12 | +{ |
| 13 | + "role": "user", |
| 14 | + "content": "Hello there" |
| 15 | +}, |
| 16 | +{ |
| 17 | + "role": "assistant", |
| 18 | + "content": "Hello there", |
| 19 | + "tool_calls": [ |
| 20 | + { |
| 21 | + "type": "function", |
| 22 | + "function": { |
| 23 | + "name": "greet", |
| 24 | + "arguments": { |
| 25 | + "name": "there" |
| 26 | + } |
18 | 27 | } |
19 | 28 | } |
20 | | - } |
21 | | -]}, |
22 | | -{"role": "user", "content": "I need help with something."}, |
23 | | -``` |
| 29 | + ] |
| 30 | +}, |
| 31 | +{ |
| 32 | + "role": "user", |
| 33 | + "content": "I need help with something." |
| 34 | +} |
| 35 | +``` |
| 36 | + |
| 37 | +Based on this simple format, it is easy to integrate your agent with Invariant `testing`. |
| 38 | + |
| 39 | +> **Extended Format Support** `testing` also supports additional custom properties in the trace format, e.g. for metadata. Note, however, that convenience methods like `Trace.tool_calls()` assume the standard format. Similarly, if you are planning to visualize the trace in [Explorer](/explorer/), we advise you to stick to the standard format. |
| 40 | +
|
| 41 | +To learn about how to do this, follow one of the example guides below: |
| 42 | + |
| 43 | +<div class='tiles'> |
| 44 | + |
| 45 | +<a href="/testing/Examples/computer-use/" class='tile primary'> |
| 46 | + <span class='tile-title'>Computer Use Agents →</span> |
| 47 | + <span class='tile-description'>Integrate your computer use agent with Invariant <code>testing</code></span> |
| 48 | +</a> |
| 49 | + |
| 50 | +<a href="/testing/Examples/langgraph/" class='tile primary'> |
| 51 | + <span class='tile-title'>LangGraph Agents →</span> |
| 52 | + <span class='tile-description'>Test your LangGraph agent with <code>testing</code></span> |
| 53 | +</a> |
| 54 | + |
| 55 | +<a href="/testing/Examples/openai-python-agent/" class='tile'> |
| 56 | + <span class='tile-title'>Function Calling Agents →</span> |
| 57 | + <span class='tile-description'>Integrate your agent with Invariant <code>testing</code> using function calls</span> |
| 58 | +</a> |
| 59 | + |
| 60 | +<a href="/testing/Examples/swarm/" class='tile'> |
| 61 | + <span class='tile-title'>Swarm Agents →</span> |
| 62 | + <span class='tile-description'>Test your swarm agent with Invariant <code>testing</code></span> |
| 63 | +</a> |
| 64 | + |
| 65 | +</div> |
0 commit comments