All notable changes to the You.com Python SDK will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Research API: New
research()andresearch_async()methods on the mainYouclient for comprehensive, multi-step research answers with citations. The Research API goes beyond a single web search by running multiple searches, reading sources, and synthesizing thorough, well-cited answers.
from youdotcom import You
from youdotcom.models import ResearchEffort
you = You()
res = you.research(
input="What are the latest advances in quantum computing?",
research_effort=ResearchEffort.DEEP,
)
print(res.output.content)
for source in res.output.sources:
print(f" - {source.title or 'Untitled'}: {source.url}")ResearchEffortenum: Controls depth of research (lite,standard,deep,exhaustive)- Research models:
ResearchRequest,ResearchResponse,Output,Source,ContentType - Research errors:
ResearchUnauthorizedError,ResearchForbiddenError,ResearchInternalServerError,UnprocessableEntityError AgentRuns400ResponseError: New error class for 400 Bad Request responses from the Agents API
- Default server URL: Changed from
https://ydc-index.iotohttps://api.you.com. If you were relying on the default, no action needed as both resolve to the same API. - Python version requirement: Now requires Python >=3.10 (previously >=3.9.2)
- Search API
countparameter: Now defaults to10instead ofNone - Contents API
crawl_timeout: Type changed fromfloattoint, default is now10seconds - Speakeasy generator: Updated from v2.801.2 to v2.845.12
- Renamed
SearchContentstoContents: TheSearchContentsmodel has been renamed toContentsand moved to its own module (youdotcom.models.contents). The interface remains the same withhtmlandmarkdownfields.
- News results now support
contentsfield: When usinglivecrawl=NEWSorlivecrawl=ALL, news results can now include crawled page contents (HTML and/or Markdown), just like web results. This enables richer news content retrieval.
from youdotcom.models import LiveCrawl, LiveCrawlFormats
# Get news with crawled contents
res = you.search.unified(
query="technology news",
livecrawl=LiveCrawl.NEWS,
livecrawl_formats=LiveCrawlFormats.MARKDOWN,
)
for news_item in res.results.news:
if news_item.contents:
print(news_item.contents.markdown)SearchContents: Replaced byContents. If you were importingSearchContentsdirectly, update your imports to useContents.
The Agents API now uses typed request classes instead of the AgentType enum, providing better type safety, IDE autocompletion, and clearer intent.
Before (1.x):
from youdotcom.types.typesafe_models import AgentType, SearchEffort, Verbosity
you.agents.runs.create(
agent=AgentType.EXPRESS,
input="What is the capital of France?",
stream=False,
)
you.agents.runs.create(
agent=AgentType.ADVANCED,
input="Research quantum computing",
stream=False,
tools=[ResearchTool(search_effort=SearchEffort.AUTO, report_verbosity=Verbosity.HIGH)]
)
you.agents.runs.create(
agent="your-custom-agent-uuid",
input="Custom query",
stream=False,
)After (2.0):
from youdotcom.models import (
ExpressAgentRunsRequest,
AdvancedAgentRunsRequest,
CustomAgentRunsRequest,
ResearchTool,
SearchEffort,
ReportVerbosity,
)
you.agents.runs.create(
request=ExpressAgentRunsRequest(
input="What is the capital of France?",
stream=False,
)
)
you.agents.runs.create(
request=AdvancedAgentRunsRequest(
input="Research quantum computing",
stream=False,
tools=[ResearchTool(search_effort=SearchEffort.AUTO, report_verbosity=ReportVerbosity.HIGH)]
)
)
you.agents.runs.create(
request=CustomAgentRunsRequest(
agent="your-custom-agent-uuid",
input="Custom query",
stream=False,
)
)Why this is better:
- Type safety: Each agent type has its own request class with the appropriate fields
- IDE support: Better autocompletion since each request type only shows relevant options
- Validation: Invalid combinations are caught at development time, not runtime
- Clarity: The request type makes the intent explicit in the code
All models are now imported from youdotcom.models instead of the separate typesafe_models module.
Before (1.x):
from youdotcom.types.typesafe_models import (
AgentType,
SearchEffort,
Verbosity,
Country,
Freshness,
LiveCrawl,
Format,
)After (2.0):
from youdotcom.models import (
ExpressAgentRunsRequest,
AdvancedAgentRunsRequest,
SearchEffort,
ReportVerbosity,
Country,
Freshness,
LiveCrawl,
ContentsFormat,
)Why this is better:
- Single import location: All models in one place
- Cleaner namespace: No nested module paths
- Better discoverability: Easier to find available models
| Old Name (1.x) | New Name (2.0) | Reason |
|---|---|---|
Verbosity |
ReportVerbosity |
More specific—clarifies it controls research report verbosity |
Format |
ContentsFormats |
Avoids collision with Python's built-in format(), plural indicates array usage |
AgentType |
Removed | Replaced by typed request classes |
The Contents API now uses a formats array instead of a single format_ parameter, allowing you to request multiple content types in a single call.
Before (1.x):
res = you.contents.generate(
urls=["https://example.com"],
format_=Format.MARKDOWN,
)After (2.0):
from youdotcom.models import ContentsFormats
# Request single format
res = you.contents.generate(
urls=["https://example.com"],
formats=[ContentsFormats.MARKDOWN],
)
# Request multiple formats at once
res = you.contents.generate(
urls=["https://example.com"],
formats=[ContentsFormats.HTML, ContentsFormats.MARKDOWN, ContentsFormats.METADATA],
)Why this is better:
- Multiple formats: Request HTML, Markdown, and Metadata in a single API call
- Metadata support: New
METADATAformat returns json+ld and OpenGraph information - Flexibility: Get exactly the content types you need
The new METADATA format returns structured metadata about web pages including json+ld and OpenGraph information.
res = you.contents.generate(
urls=["https://example.com"],
formats=[ContentsFormats.METADATA],
)
for item in res:
if item.metadata:
print(f"Site Name: {item.metadata.site_name}")
print(f"Favicon: {item.metadata.favicon_url}")A new optional crawl_timeout parameter allows you to control the maximum time (1-60 seconds) spent crawling each URL.
res = you.contents.generate(
urls=["https://example.com"],
formats=[ContentsFormats.HTML],
crawl_timeout=30, # Wait up to 30 seconds per URL
)The following helper functions have been removed in favor of working directly with typed response objects:
| Removed Function | Replacement |
|---|---|
get_text_tokens(response) |
Access response.output[0].text directly |
stream_text_tokens(response) |
Iterate over streaming events (see example below) |
print_search(response) |
Access response.results and response.metadata directly |
print_contents(response) |
Access response contents directly |
Why this is better:
- Full control: Access all response fields, not just what helpers exposed
- Type safety: Response objects are fully typed for IDE support
- Flexibility: Handle responses exactly as your application needs
Streaming responses now use properly typed event classes for better handling.
Before (1.x):
res = you.agents.runs.create(agent=AgentType.EXPRESS, input="...", stream=True)
stream_text_tokens(res) # Helper function handled everythingAfter (2.0):
from youdotcom.models import (
ResponseCreated,
ResponseStarting,
ResponseOutputTextDelta,
ResponseOutputContentFull,
ResponseDone,
)
response = you.agents.runs.create(
request=ExpressAgentRunsRequest(input="...", stream=True)
)
with response as stream:
for chunk in stream:
event = chunk.data
if isinstance(event, ResponseCreated):
print(f"Started: {event.seq_id}")
elif isinstance(event, ResponseOutputTextDelta):
print(event.response.delta, end="", flush=True)
elif isinstance(event, ResponseOutputContentFull):
# Handle web search results, etc.
for result in event.response.full:
print(f"Source: {result.url}")
elif isinstance(event, ResponseDone):
print(f"\nCompleted in {event.response.run_time_ms}ms")Why this is better:
- Granular control: Handle each event type appropriately
- Type safety: Each event type has typed fields
- Rich metadata: Access timing, sequence IDs, and intermediate results
Error classes have been renamed for consistency and clarity:
| Old Name (1.x) | New Name (2.0) |
|---|---|
PostV1AgentsRunsUnauthorizedError |
AgentRuns401ResponseError |
PostV1AgentsRunsForbiddenError |
Removed (403 now handled by YouDefaultError) |
GetV1SearchUnauthorizedError |
SearchUnauthorizedError |
GetV1SearchForbiddenError |
SearchForbiddenError |
PostV1ContentsUnauthorizedError |
ContentsUnauthorizedError |
PostV1ContentsForbiddenError |
ContentsForbiddenError |
Why this is better:
- Readable names: No HTTP method prefixes cluttering the name
- Consistent pattern:
{Operation}{StatusCode}Erroror{Operation}{Description}Error
ExpressAgentRunsRequest: Typed request for Express agent callsAdvancedAgentRunsRequest: Typed request for Advanced agent callsCustomAgentRunsRequest: Typed request for Custom agent calls (with UUID)AgentRunsBatchResponse: Typed response for non-streaming agent callsAgentRunsStreamingResponse: Typed response wrapper for streaming- Streaming event types:
ResponseCreated,ResponseStarting,ResponseOutputItemAdded,ResponseOutputContentFull,ResponseOutputTextDelta,ResponseOutputItemDone,ResponseDone ReportVerbosity: Enum for research tool report detail levelContentsFormats: Enum for contents API format selection (html, markdown, metadata)ContentsMetadata: Model for metadata response (site_name, favicon_url)- Contents API
formatsparameter: Array of formats to request (replaces singleformat_) - Contents API
crawl_timeoutparameter: Optional timeout (1-60 seconds) for URL crawling - Contents API
METADATAformat: Returns json+ld and OpenGraph information
youdotcom.types.typesafe_modelsmodule - all models now inyoudotcom.modelsAgentTypeenum - replaced by typed request classesVerbosity- renamed toReportVerbosityFormat- renamed toContentsFormats(note the 's')format_parameter in Contents API - replaced byformatsarray- Helper functions:
get_text_tokens(),stream_text_tokens(),print_search(),print_contents()
- Updated search results to include
contentsfield when livecrawl is enabled
- Renamed
request_uuidtosearch_uuidin search metadata for consistency
- Version update for PyPI compatibility
- Initial stable release
- Agents API with Express, Advanced, and Custom agents
- Search API with unified search endpoint
- Contents API for web page content retrieval
- Typesafe models for all API responses
- Streaming support via Server-Sent Events (SSE)