Skip to content

Conversation

@kevmalek
Copy link
Collaborator

@kevmalek kevmalek commented Dec 12, 2025

DX-94: Unified API Spec for Agents

High level notes:

  • All the yaml files live in the folder openapi_schemas
  • .speakeasy/workflow.yaml is where we tell speakeasy to compile the openAPI yaml files together
  • .speakeasy/gen.yaml python.version is where we can set the version number (currently set to 1.5.0)
  • examples/api-example-calls.py lists the type safe ways of running our endpoints
  • Readme.md and related files are all auto generated
  • Removed the need for x-speakeasy-enums in the openAPI yaml files after setting python.enumFormat to enum in the .speakeasy/gen.yaml
  • src/youdotcom/_hooks/registration.py contains the code to set the user agent header to our custom value

All other files are Speakeasy generated

Copy link
Contributor

@tyler5673 tyler5673 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left quite a lot of comments, more conversations may come out of them so leaving status as request changes for now

"stream": False,
})

### Example with Advanced agent and tools
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There doesn't seem to be any examples of advanced agent or tool functionality now

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some changes and this has gone away. Also was autogenerated

])
res = you.agents_runs(request={
"agent": "express",
"input": "What is the capital of France?",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems like every example is express agent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is generated by Speakeasy. working with them to figure out how we can get their tools to pick a different example from the openapi_unified_agents.yaml of which there are many. See examples: on line 35

# Helper Functions for Type-Safe Event Handling
# ============================================================================

def parse_sse_event(event: Any) -> SSEEvent:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may want to keep some of the helper functions! most likely not all, but parse_sse_event may be useful to some for example

Copy link
Collaborator Author

@kevmalek kevmalek Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at api-example-calls.py in the examples folder, def express_streaming_request() is setup to look for SSE events all in a typesafe way, (same with the other calls) so i don't think we need this function or the other helpers

Specifically using isinstance() casts the chunk data

for chunk in stream:
    event_data = chunk.data

    # Use isinstance() to narrow the type and handle each event
    if isinstance(event_data, ResponseCreated):
        print(f"✨ Response created (seq: {event_data.seq_id})")

    elif isinstance(event_data, ResponseStarting):
        print(f"🚀 Response starting (seq: {event_data.seq_id})")

    elif isinstance(event_data, ResponseOutputItemAdded):
        print(f"➕ Output item added: {event_data.seq_id}")

    elif isinstance(event_data, ResponseOutputContentFull):
        print("\n🔍 Web Search Results:")
        if event_data.response.full:
            for idx, result in enumerate(event_data.response.full, 1):
                print(f"  {idx}. {result.title} - {result.url}")
                ...

I also added some example code in the readme to show how to process streaming tokens under Server-sent event streaming. Let me know. I think we're good here!

@kevmalek kevmalek requested a review from tyler5673 December 16, 2025 21:12
requestBodyFieldName: body
persistentEdits: {}
tests:
generateTests: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably want this false since we have a custom test suite

Copy link
Collaborator Author

@kevmalek kevmalek Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, thanks. Also note that when I set it to false, and rerun speakeasy run to regenerate the data, the script removes the entire tests: portion of the yaml on its own.


results = you.agents.runs.create(request=request)

res = you.agents.runs.create(request={
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call is unneeded here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appreciate it!

@kevmalek kevmalek requested a review from tyler5673 December 17, 2025 21:29
@kevmalek kevmalek changed the base branch from main to release/2.0.0 December 18, 2025 23:23
@kevmalek kevmalek merged commit d43a4b7 into release/2.0.0 Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants