agents and agency in the internet by greg meredith

57
Agents and Agency in the Internet: How we get there is where we are going L.G. Meredith Managing Partner, Biosimilarity LLC ScalaBay October Meetup Wednesday, October 30, 13

Upload: hakka-labs

Post on 10-May-2015

1.844 views

Category:

Technology


0 download

DESCRIPTION

“Agents and Agency in the Internet,” Greg Meredith talks about SpecialK/KVDB, a scala library for writing distributed applications in an embedded DSL that’s based on the applied Pi-calculus. He focuses on two applications that are using SpecialK, Protunity and the Individual Agent. Greg will introduce the embedded DSL and its relationship to theory and practice. He will then look at the both of the different applications and the talk on the advantages such framework brings to those efforts. Of particular interest is how the framework allows for a higher level automated reasoning about information flow in the distributed network.

TRANSCRIPT

Page 1: Agents and Agency in the Internet by Greg Meredith

Agents and Agency in the Internet:

How we get there is where we are going

L.G. MeredithManaging Partner, Biosimilarity LLC

ScalaBay October Meetup

Wednesday, October 30, 13

Page 2: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Outline• A few verbs

• Their implementation

• A b2b application using them

• A c2c application using them

• Summary

• Questions

Wednesday, October 30, 13

Page 3: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs

• These verbs are designed to make it easy for distributed applications talk to one another

• They are built around the constructive interpretation of a single logical principle:

A or ~A

Wednesday, October 30, 13

Page 4: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbsLet’s illustrate with a cartoon.

valuekey valuekey valuekey valuekey valuekey

Wednesday, October 30, 13

Page 5: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Let’s imagine an app...

4 hr

8 hrin 5 mins

getting coffee

at Ladro

in 2 mins

in 10 mins

Let's meetat

Ladro in 10|

Wednesday, October 30, 13

Page 6: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC4

hr

8 hrin 5 mins

getting coffee

at Ladro

in 2 mins

in 10 mins

Let's meetat

Ladro in 10|

Looks like we'll all be

there

Let’s imagine an app...

Wednesday, October 30, 13

Page 7: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbsAn application like this could benefit from the ability to

• Make a standing query

• Post data to standing queries

• Store data conventionally

• Read data conventionally

Wednesday, October 30, 13

Page 8: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs

4 hr

8 hr

in 5 mins

getting coffee

at Ladro

in 2 mins

in 10 mins

Let's meetat

Ladro in 10|

Looks like we'll all be there

valuekeyvaluekeyvaluekeyvaluekeyvaluekey

4 hr

8 hr

in 5 mins

getting coffee

at Ladro

in 2 mins

in 10 mins

Let's meetat

Ladro in 10|

Looks like we'll all be there

Wednesday, October 30, 13

Page 9: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs

4 hr

8 hr

in 5 mins

getting coffee

at Ladro

in 2 mins

in 10 mins

Let's meetat

Ladro in 10|

Looks like we'll all be there

valuekeyvaluekeyvaluekeyvaluekey

?key

When a query arrives at a key and there is no dataa continuation is stored

Wednesday, October 30, 13

Page 10: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs

When data arrives at a key and there is no continuation,

the data is stored

valuekeyvaluekeyvaluekeyvaluekeyvaluekey

4 hr

8 hr

in 5 mins

getting coffee

at Ladro

in 2 mins

in 10 mins

Let's meetat

Ladro in 10|

Looks like we'll all be there

value

Wednesday, October 30, 13

Page 11: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbsWe can make some decisions about the nature of the interaction with respect to the stored entity (continuation or data)

• The action can consume the stored entity

• The action can make a copy the stored entity and allow interaction on the copy

Wednesday, October 30, 13

Page 12: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs

ephemeral - dataephemeral - k

persistent - dataephemeral - k

ephemeral - dataperistent - k

persistent - datapersistent - k

producer put store publishpublish with

history

consumer get read subscribe subscribe

Wednesday, October 30, 13

Page 13: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs

ephemeral - dataephemeral - k

persistent - dataephemeral - k

ephemeral - dataperistent - k

persistent - datapersistent - k

producer put store publishpublish with

history

consumer get read subscribe subscribe

Traditional DB operations

Wednesday, October 30, 13

Page 14: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs

ephemeral - dataephemeral - k

persistent - dataephemeral - k

ephemeral - dataperistent - k

persistent - datapersistent - k

producer put store publishpublish with

history

consumer get read subscribe subscribe

Traditional messaging operations

Wednesday, October 30, 13

Page 15: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs

ephemeral - dataephemeral - k

persistent - dataephemeral - k

ephemeral - dataperistent - k

persistent - datapersistent - k

producer put store publishpublish with

history

consumer get read subscribe subscribe

We use these for item-level locking in a

distributed setting

Wednesday, October 30, 13

Page 16: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs

How is this related to the constructive interpretation of the logical principle

A or ~A

Wednesday, October 30, 13

Page 17: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs

Now, how is this related to the π-calculus?

Wednesday, October 30, 13

Page 18: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs4

hr

8 hr

in 5 mins

getting coffee

at Ladro

in 2 mins

in 10 mins

Let's meetat

Ladro in 10|

Looks like we'll all be there

valuekeyvaluekeyvaluekeyvaluekey

?key

Let’s design a DSL for these verbs. Following LINQ we’ll have consumption map to for-

comprehensions.

for( e <- collection.<verb>( key ) if cond ) { handle( e )}

Wednesday, October 30, 13

Page 19: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs

And we’ll have production follow messaging style

collection.<verb>( key, value )valuekeyvaluekeyvaluekeyvaluekeyvaluekey

4 hr

8 hr

in 5 mins

getting coffee

at Ladro

in 2 mins

in 10 mins

Let's meetat

Ladro in 10|

Looks like we'll all be there

value

Wednesday, October 30, 13

Page 20: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs

If we squint a little we can just make out the π-calculus.

Wednesday, October 30, 13

Page 21: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

valuekey valuekey valuekey valuekey valuekey

valuekey valuekey valuekey valuekey valuekey

JVM JVM

AMQP AMQP

cache cache

in 5

mins

getting coffee at Ladro in

2 mins

in 10 mins

Let's meetat

Ladro in 10

|

Looks like we'll all be there

get

check cache

check store

recurse

forward

Wednesday, October 30, 13

Page 22: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

How does this relate to agents in the Internet?

valuekey valuekey valuekey valuekey valuekey

valuekey valuekey valuekey valuekey valuekey

A connection between two agents is treated as

a pair of channels

Each channel has its own store

Wednesday, October 30, 13

Page 23: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

How does this relate to agents in the Internet?

valuekey valuekey valuekey valuekey valuekey

valuekey valuekey valuekey valuekey valuekey

Channels are subpartitioned by keys

Wednesday, October 30, 13

Page 24: Agents and Agency in the Internet by Greg Meredith

Putting it all together

JVM

Scala Runtime RabbitMQ

KVDB1, KDVB2JVM

Scala Runtime RabbitMQ

KVDB1

JVM

Scala Runtime RabbitMQ

KVDB1

XMLDB RabbitMQ Queue

XMLDBRabbitMQ Queue

XMLDBRabbitMQ Queue

RabbitMQ Queue

JVM

Scala Runtime RabbitMQ

KVDB2

JVM

Scala Runtime RabbitMQ

KVDB2

XMLDBRabbitMQ Queue

XMLDBRabbitMQ Queue

for( event1 <- kvdb1.get( pattern1 ); event2 <- kvdb2.get( pattern2 ); if ( cond( event1, event2 ) ) ) { handle( event1, event2 ) }

PlatformAgent

PlatformAgent

PlatformAgent

PlatformAgent

PlatformAgent

Agent Behavior

A generic process agent is an instance of an agent behavior. These run on platform agents. An agent in the sense Fred defines

is realized as an instance of a specific agent behavior that implements one or more of agent services protocols including

introduction, invitation, verification, etc.

Wednesday, October 30, 13

Page 25: Agents and Agency in the Internet by Greg Meredith

What is SpecialK?

KVDB verbs

Process agent

Agent services agentfor( event1 <- kvdb1.get( pattern1 ); event2 <- kvdb2.get( pattern2 ); if ( cond( event1, event2 ) ) ) { handle( event1, event2 ) }

get, put, subscribe, publish, fetch, store, ...over patterns described by

pattern ::= groundValue| variable

| symbol( pattern* )

Agent Behavior

for( introReq <- kvdb1.get( introduce( reqAgentId, trgtAgentId ) )) { kvdb1.put( acceptIntro?( reqAgentId, trgtAgentId ) ) for( introRsp <- kvdb.get( introRsp( trgtAgentId, reqAgentId ) ) { introRsp match { case Confirm( sharingLevel ) => ... case Deny( reason ) => ... } }} Introduction

Behavior

KDVB capability

Example only! Not actual

implementation

@sequence( @act( verb, patternSpec ) @separate( P1, P2 ) )

PropertySpecification

Scala annotation syntax not finalized!

Agent properties

Agent addressing

Wednesday, October 30, 13

Page 26: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

A few verbs in action

Here’s a version of the introduction protocol for more realz and less lolz

Wednesday, October 30, 13

Page 27: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Backup slides

Wednesday, October 30, 13

Page 28: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Compositionality

In computing scaling sometimes refers to lots of

copies the same thing

Lots of chips, lots of boxes, lots of databases, lots of

servers, lots of data centers

Wednesday, October 30, 13

Page 29: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Compositionality

Compositionality turns that upside down. It says that

scaling is about making the large reflect the small.

Wednesday, October 30, 13

Page 30: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Compositionality

This is how nature scales.

Wednesday, October 30, 13

Page 31: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

But, it’s actually a fairly new thing that humans have begun to

structuring their thinking and doing this way

Compositionality

Wednesday, October 30, 13

Page 32: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Compositionality

Here are a few people whose computationally effective ideas were

not compositional

As a result, the physics of the small doesn’t scale to the physics of the

large (or vice versa)

Wednesday, October 30, 13

Page 33: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Compositionality

Computing is naturally organized compositionally

Wednesday, October 30, 13

Page 34: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Compositionality

Data structures are organized compositionally

• Lists

• Trees

• ...

Wednesday, October 30, 13

Page 35: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Compositionality

The syntax of programming languages are organized compositionally

P ::= ...

val identifier [: typeDecl] = valueExpr ; P

Wednesday, October 30, 13

Page 36: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

CompositionalityThe fundamental organization of the mathematics of computation is compositional

• λ-calculus

• M, N ::= x | λ x. M | M N

• π-calculus

• P, Q ::= 0 | x?( y )P | x!( v ) | P|Q | (new x)P | !P

• Category Theory

Wednesday, October 30, 13

Page 37: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Agility Agility is not just about being quick, light and

responsive

Wednesday, October 30, 13

Page 38: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Agility

It’s primarily about being iterative -- moving from one expression of the whole to

the next

Wednesday, October 30, 13

Page 39: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Agility This is really applying compositionality to scaling

processes that occur in time

As such, thinking about the software development

process as finding a fix-point of an iterated transformation goes at least as far back as

the 70’s

Wednesday, October 30, 13

Page 40: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Agility

This also lines up with the organization of the maths underlying computation

Y = λf.(λx.f (x x)) (λx.f (x x))

Wednesday, October 30, 13

Page 41: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Agilitydef Y[A,B](f: (A=>B)=>(A=>B)) = {

case class W(wf: W=>A=>B) {

def apply(w: W) = wf(w)

}

val g: W=>A=>B = w => f(w(w))(_)

g(W(g))

}

Wednesday, October 30, 13

Page 42: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Agilityval fac = Y[Int, Int](f => i => if (i <= 0) 1 else f(i - 1) * i)

fac(6) //> res0: Int = 720 val fib = Y[Int, Int](f => i => if (i < 2) i else f(i - 1) + f(i - 2))fib(6) //> res1: Int = 8

Wednesday, October 30, 13

Page 43: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

AgilityIteratively moving from a whole expression of a solution to a more refined version of a whole expression of a solution:

• makes sense mathematically

• makes sense organizationally

• is what happens in nature

Wednesday, October 30, 13

Page 44: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Transparency

Transparency lets us see the inner workings of a solution

trace the lines from form to function

Wednesday, October 30, 13

Page 45: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Transparency

In computing transparency is a form of compositionality -- a semantics for a model of computation is compositional if we follow the form of a program to determine its semantics, i.e. what it is and/or what it does

Wednesday, October 30, 13

Page 46: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Transparency

In software development transparency is the ability to trace from requirements all the way down to lines of code

Wednesday, October 30, 13

Page 47: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Transparency

In organizations transparency is the ability for any one member to trace information and communication all the way through the chain or collection of people in the organization who come together to achieve a goal

Wednesday, October 30, 13

Page 48: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Transparency

In each case there is an inner structure that supports and guides the process

Making that inner structure explicit and visible is a vital part of that support

Wednesday, October 30, 13

Page 49: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Accountability

We stand by the results of our work

We are clear about the conditions under which people may rely on the

results of our work

Wednesday, October 30, 13

Page 50: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Accountability

In computing accountability is closely connected to proof. We stand by a claim about how computation works by being able to produce, on demand, a proof of that claim. Proofs only work when the necessary hypothesis explicit and clear.

Wednesday, October 30, 13

Page 51: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Accountability

In software development -- like science -- accountability is closely connected to testing. We stand by a claim about what our software can and cannot do by producing the tests that demonstrate the software’s behavior. Tests results are only reproduce-able if we are clear about the test conditions.

Wednesday, October 30, 13

Page 52: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

Accountability

In organizations accountability is closely connected to responsibility. Standing by the results of our work doesn’t mean we don’t make mistakes. It means we own them and are willing to use them as a means of improving our offering (see agility).

Wednesday, October 30, 13

Page 53: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

SummaryFostering

compositionality

agility

transparency

accountability

is like following a hidden score

Wednesday, October 30, 13

Page 54: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

SummaryCode and systems scale

because they are

composed of

reconfigurable

components

the behavior of which we stand by

and support

Wednesday, October 30, 13

Page 55: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

SummaryTeams scale

because they are

composed of

agile and

responsible

players supported by the

inner working of their organization

Wednesday, October 30, 13

Page 56: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

SummaryIn short, these are the

building blocks

of self-organization

that recognize

selves are made of selves are made

of ... that become coherent when

they are both supported and relied on

Wednesday, October 30, 13

Page 57: Agents and Agency in the Internet by Greg Meredith

ScalaBay October Meetup

L.G. Meredith, Managing Partner, Biosimilarity LLC

That’s how we do itif how we get there is where

we are going

Wednesday, October 30, 13