Localize the web console and persist custom model and capability settings. Use OpenAI Responses exclusively and move runtime limits into environment configuration. Bootstrap uv and the virtual environment on Windows, support optional China mirrors, and package source distributions without environments, build output, or credentials. Update regression tests and repository quality checks for the new behavior.
106 lines
3.3 KiB
Python
106 lines
3.3 KiB
Python
# Copyright 2026 Google LLC
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
"""Video Transcription Example
|
|
|
|
This example demonstrates how to use the video recording tools to capture
|
|
and analyze video content from a mobile device screen.
|
|
|
|
The agent can:
|
|
1. Start a screen recording
|
|
2. Perform actions while recording
|
|
3. Stop the recording and analyze its content using sampled frames with Responses
|
|
|
|
Use case: Recording a video playing on the screen and transcribing its content.
|
|
"""
|
|
|
|
import asyncio
|
|
|
|
from artemis.config import LLM, LLMConfig, LLMConfigUtils, LLMWithFallback
|
|
from artemis.config import settings
|
|
from artemis.sdk.agent import Agent
|
|
from artemis.sdk.builders.agent_config_builder import AgentConfigBuilder
|
|
from artemis.sdk.types.agent import AgentConfig
|
|
from artemis.sdk.types.task import AgentProfile, TaskRequest
|
|
|
|
|
|
def get_video_capable_llm_config() -> LLMConfig:
|
|
"""Returns an LLM config with video_analyzer configured.
|
|
|
|
Set OPENAI_MODEL to a Responses model with image input support.
|
|
"""
|
|
return LLMConfig(
|
|
planner=LLMWithFallback(
|
|
provider="openai",
|
|
model=settings.OPENAI_MODEL,
|
|
fallback=LLM(provider="openai", model=settings.OPENAI_MODEL),
|
|
),
|
|
utils=LLMConfigUtils(
|
|
outputter=LLMWithFallback(
|
|
provider="openai",
|
|
model=settings.OPENAI_MODEL,
|
|
fallback=LLM(provider="openai", model=settings.OPENAI_MODEL),
|
|
),
|
|
hopper=LLMWithFallback(
|
|
provider="openai",
|
|
model=settings.OPENAI_MODEL,
|
|
fallback=LLM(provider="openai", model=settings.OPENAI_MODEL),
|
|
),
|
|
video_analyzer=LLMWithFallback(
|
|
provider="openai",
|
|
model=settings.OPENAI_MODEL,
|
|
fallback=LLM(provider="openai", model=settings.OPENAI_MODEL),
|
|
),
|
|
),
|
|
)
|
|
|
|
|
|
async def main():
|
|
config: AgentConfig = (
|
|
AgentConfigBuilder()
|
|
.add_profile(
|
|
AgentProfile(
|
|
name="VideoCapable",
|
|
llm_config=get_video_capable_llm_config(),
|
|
)
|
|
)
|
|
.with_video_recording_tools()
|
|
.build()
|
|
)
|
|
|
|
agent = Agent(config=config)
|
|
try:
|
|
await agent.init()
|
|
|
|
result = await agent.run_task(
|
|
request=TaskRequest(
|
|
goal="""
|
|
1. Open YouTube app
|
|
2. Search for "Python tutorial"
|
|
3. Start recording the screen
|
|
4. Play the first video
|
|
5. Wait for the first 30 seconds of the video to play
|
|
6. Stop recording and tell me what was said in the video
|
|
""",
|
|
profile="VideoCapable",
|
|
)
|
|
)
|
|
print(f"Task result: {result}")
|
|
finally:
|
|
await agent.clean()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|