skip to content
Alvin Lucillo

Accessing an agent via code

/ 2 min read

This requires you have an agent created. Click Continue in code button and run the code on your local machine.

# Before running the sample:
#    pip install "azure-ai-projects>=2.1.0"

from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient

endpoint = "https://redacted-resource.services.ai.azure.com/api/projects/redacted"
agent_name = "agent1"
user_message = "What can you tell me about the Altair 8800?"

with (
    DefaultAzureCredential() as credential,
    AIProjectClient(
        endpoint=endpoint,
        credential=credential,
        allow_preview=True,
    ) as project_client,
):
    # Bind the OpenAI client to the existing agent endpoint.
    openai_client = project_client.get_openai_client(agent_name=agent_name)

    # GitHub Copilot preview agents require a conversation for every Responses turn.
    conversation = openai_client.conversations.create()
    response = openai_client.responses.create(
        conversation=conversation.id,
        input=[{"role": "user", "content": user_message}],
    )

    print(f"Response output: {response.output_text}")
➜ python az901.py

Response output: Short summary
- The Altair 8800 was an early microcomputer kit sold by MITS (Micro Instrumentation and Telemetry Systems) that helped launch the personal computer era. 
- It used the Intel 8080 (8080A) CPU and the S-100 bus architecture; memory and I/O were provided on plug-in boards. 
- The machine is famous for its front-panel of toggle switches and LEDs used to enter and view memory and for spurring a hobbyist and commercial ecosystem of hardware and software. 

Key technical points (at-a-glance)
- Manufacturer: MITS (Micro Instrumentation and Telemetry Systems). 
- Typical CPU: Intel 8080 (8080A). 
- Bus: S-100 (also called the Altair bus). 
- Modular design: separate CPU board, memory boards (e.g., 1K RAM boards), display/control (front-panel) board, power supply, and expansion/explorer boards. 

Why it matters
- The Altair showed that a relatively low-cost microprocessor-based system could be built and sold to hobbyists and small businesses; that idea directly led to an aftermarket of third-party boards, software, and eventually the companies and communities that created personal computing. 

If you want more
- I can give a short timeline (announcement/release dates), more detailed specs (memory sizes, power, form factor), notable software (e.g., early BASIC ports), how the S-100 bus worked, or primary sources (magazine ads, manuals, and photos). Which of those would you like next?